Rant on CPSC Class
-
... or to be more exact something on the last test. The teacher decided to take off a point because I wrote static in a method declaration. There was no reason for the method to NOT be static. :( The question I wrote the method for said, "Write a method that reads in three floating point numbers and put them into an array." My answer was as follows:
public static void ReadF3(float arr[]) {
Scanner cin = new Scanner(System.in);
for (int x=0; x<3; x++) {
System.out.print("Enter a number: ");
= cin.nextFloat();
}
}In case anyone is wondering, the langauge is Java. If she just wanted to take a point off, at least she could have done it for something that was wrong like that fact that I did not check the length of the array. In any case, when the same question showed up on the final today, I did the same thing, only with a diffrent method name and I did check the length of the array. I also included comments (on the final there was more space) that said that making it static is correct and explained why. PS: I still got a 91 on the test the question first showed up on, so it was not a big deal. However, I dislike losing points for something I did right.
-
... or to be more exact something on the last test. The teacher decided to take off a point because I wrote static in a method declaration. There was no reason for the method to NOT be static. :( The question I wrote the method for said, "Write a method that reads in three floating point numbers and put them into an array." My answer was as follows:
public static void ReadF3(float arr[]) {
Scanner cin = new Scanner(System.in);
for (int x=0; x<3; x++) {
System.out.print("Enter a number: ");
= cin.nextFloat();
}
}In case anyone is wondering, the langauge is Java. If she just wanted to take a point off, at least she could have done it for something that was wrong like that fact that I did not check the length of the array. In any case, when the same question showed up on the final today, I did the same thing, only with a diffrent method name and I did check the length of the array. I also included comments (on the final there was more space) that said that making it static is correct and explained why. PS: I still got a 91 on the test the question first showed up on, so it was not a big deal. However, I dislike losing points for something I did right.
I'd have personally returned the array from the function rather than accepting it as a parameter. How do arrays work in Java? If you pass an array to a function, and the function modifies that array, will the array be modified once you return from that function? Or does the function copy the array? And are you sure she took off points because the method was static? Did she just point an arrow with a question mark, or did she say "you should not have made this function static" without any reason as to why? If so, I would have talked to her personally and asked why she marked me down and then explained my point of view. Even teachers have off days and grade subjectively.
-
... or to be more exact something on the last test. The teacher decided to take off a point because I wrote static in a method declaration. There was no reason for the method to NOT be static. :( The question I wrote the method for said, "Write a method that reads in three floating point numbers and put them into an array." My answer was as follows:
public static void ReadF3(float arr[]) {
Scanner cin = new Scanner(System.in);
for (int x=0; x<3; x++) {
System.out.print("Enter a number: ");
= cin.nextFloat();
}
}In case anyone is wondering, the langauge is Java. If she just wanted to take a point off, at least she could have done it for something that was wrong like that fact that I did not check the length of the array. In any case, when the same question showed up on the final today, I did the same thing, only with a diffrent method name and I did check the length of the array. I also included comments (on the final there was more space) that said that making it static is correct and explained why. PS: I still got a 91 on the test the question first showed up on, so it was not a big deal. However, I dislike losing points for something I did right.
Gwenio wrote:
The teacher decided to take off a point because I wrote static in a method declaration.
Your teacher is an idiot. Will make you wonder when you reach access modifiers, if he will get that right...
xacc.ide
IronScheme - 1.0 RC 1 - out now!
((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition -
Gwenio wrote:
The teacher decided to take off a point because I wrote static in a method declaration.
Your teacher is an idiot. Will make you wonder when you reach access modifiers, if he will get that right...
xacc.ide
IronScheme - 1.0 RC 1 - out now!
((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition -
I'd have personally returned the array from the function rather than accepting it as a parameter. How do arrays work in Java? If you pass an array to a function, and the function modifies that array, will the array be modified once you return from that function? Or does the function copy the array? And are you sure she took off points because the method was static? Did she just point an arrow with a question mark, or did she say "you should not have made this function static" without any reason as to why? If so, I would have talked to her personally and asked why she marked me down and then explained my point of view. Even teachers have off days and grade subjectively.
aspdotnetdev wrote:
If you pass an array to a function, and the function modifies that array, will the array be modified once you return from that function
Everything is a reference type in Java, except for language defined types like int, float etc..
Regards Senthil _____________________________ My Home Page |My Blog | My Articles | My Flickr | WinMacro
-
aspdotnetdev wrote:
If you pass an array to a function, and the function modifies that array, will the array be modified once you return from that function
Everything is a reference type in Java, except for language defined types like int, float etc..
Regards Senthil _____________________________ My Home Page |My Blog | My Articles | My Flickr | WinMacro
Gotcha. Perhaps it's time I refreshed my Java skills. Been a few years.
-
Gotcha. Perhaps it's time I refreshed my Java skills. Been a few years.
aspdotnetdev wrote:
Perhaps it's time I refreshed my Java skills. Been a few years.
Step back and ask yourself if you really need that ;P
xacc.ide
IronScheme - 1.0 RC 1 - out now!
((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition -
aspdotnetdev wrote:
Perhaps it's time I refreshed my Java skills. Been a few years.
Step back and ask yourself if you really need that ;P
xacc.ide
IronScheme - 1.0 RC 1 - out now!
((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth EditionI was thinking that silently to myself... didn't want to upset any of the Java fans. My biggest problem with Java from the college class I studied it in like 5 years back was that the IDE wasn't very good. I'm sure that has changed.
-
I was thinking that silently to myself... didn't want to upset any of the Java fans. My biggest problem with Java from the college class I studied it in like 5 years back was that the IDE wasn't very good. I'm sure that has changed.
aspdotnetdev wrote:
I was thinking that silently to myself... didn't want to upset any of the Java fans. My biggest problem with Java from the college class I studied it in like 5 years back was that the IDE wasn't very good. I'm sure that has not changed.
There, that should hold...
If the post was helpful, please vote, eh! Current activities: Book: Devils by Fyodor Dostoyevsky Project: Hospital Automation, final stage Learning: Image analysis, LINQ Now and forever, defiant to the end. What is Multiple Sclerosis[^]?
-
aspdotnetdev wrote:
I was thinking that silently to myself... didn't want to upset any of the Java fans. My biggest problem with Java from the college class I studied it in like 5 years back was that the IDE wasn't very good. I'm sure that has not changed.
There, that should hold...
If the post was helpful, please vote, eh! Current activities: Book: Devils by Fyodor Dostoyevsky Project: Hospital Automation, final stage Learning: Image analysis, LINQ Now and forever, defiant to the end. What is Multiple Sclerosis[^]?
Careful, with an opinion like that, you might get some people red faced with anger.
-
Careful, with an opinion like that, you might get some people red faced with anger.
meh
If the post was helpful, please vote, eh! Current activities: Book: Devils by Fyodor Dostoyevsky Project: Hospital Automation, final stage Learning: Image analysis, LINQ Now and forever, defiant to the end. What is Multiple Sclerosis[^]?
-
meh
If the post was helpful, please vote, eh! Current activities: Book: Devils by Fyodor Dostoyevsky Project: Hospital Automation, final stage Learning: Image analysis, LINQ Now and forever, defiant to the end. What is Multiple Sclerosis[^]?
There is a Facebook page for fans of "meh". I'd suggest you become a fan, but you'd probably just say "meh" ;P
-
... or to be more exact something on the last test. The teacher decided to take off a point because I wrote static in a method declaration. There was no reason for the method to NOT be static. :( The question I wrote the method for said, "Write a method that reads in three floating point numbers and put them into an array." My answer was as follows:
public static void ReadF3(float arr[]) {
Scanner cin = new Scanner(System.in);
for (int x=0; x<3; x++) {
System.out.print("Enter a number: ");
= cin.nextFloat();
}
}In case anyone is wondering, the langauge is Java. If she just wanted to take a point off, at least she could have done it for something that was wrong like that fact that I did not check the length of the array. In any case, when the same question showed up on the final today, I did the same thing, only with a diffrent method name and I did check the length of the array. I also included comments (on the final there was more space) that said that making it static is correct and explained why. PS: I still got a 91 on the test the question first showed up on, so it was not a big deal. However, I dislike losing points for something I did right.
I'd have deducted another point because you used Java. Don't bother me with technicalities like "it's a Java course!"; I'm not interested. Hand the point over.
I wanna be a eunuchs developer! Pass me a bread knife!
-
... or to be more exact something on the last test. The teacher decided to take off a point because I wrote static in a method declaration. There was no reason for the method to NOT be static. :( The question I wrote the method for said, "Write a method that reads in three floating point numbers and put them into an array." My answer was as follows:
public static void ReadF3(float arr[]) {
Scanner cin = new Scanner(System.in);
for (int x=0; x<3; x++) {
System.out.print("Enter a number: ");
= cin.nextFloat();
}
}In case anyone is wondering, the langauge is Java. If she just wanted to take a point off, at least she could have done it for something that was wrong like that fact that I did not check the length of the array. In any case, when the same question showed up on the final today, I did the same thing, only with a diffrent method name and I did check the length of the array. I also included comments (on the final there was more space) that said that making it static is correct and explained why. PS: I still got a 91 on the test the question first showed up on, so it was not a big deal. However, I dislike losing points for something I did right.
By the way (having actually looked at the code), why isn't your scanner final?
I wanna be a eunuchs developer! Pass me a bread knife!
-
I was thinking that silently to myself... didn't want to upset any of the Java fans. My biggest problem with Java from the college class I studied it in like 5 years back was that the IDE wasn't very good. I'm sure that has changed.
aspdotnetdev wrote:
I'm sure that has changed.
I spent a good part of the last two years working with NetBeans. As I've said before, compared to VS it was a breath of fresh air. It works, it's stable, and it's easily and regularly updated via the web, and it's FREE. As opposed to VS - unstable bloatware, updated once every two years at a cost designed to counter MS's falling profits elsewhere. ;P
-
Careful, with an opinion like that, you might get some people red faced with anger.
-
I'd have personally returned the array from the function rather than accepting it as a parameter. How do arrays work in Java? If you pass an array to a function, and the function modifies that array, will the array be modified once you return from that function? Or does the function copy the array? And are you sure she took off points because the method was static? Did she just point an arrow with a question mark, or did she say "you should not have made this function static" without any reason as to why? If so, I would have talked to her personally and asked why she marked me down and then explained my point of view. Even teachers have off days and grade subjectively.
aspdotnetdev wrote:
How do arrays work in Java?
Same as C#. Only, in C#, you have the extra power the ref keyword gives you, but I've personally never seen a single case where it has been used as intended.
Cheers, Vikram. (Got my troika of CCCs!)
-
I'd have personally returned the array from the function rather than accepting it as a parameter. How do arrays work in Java? If you pass an array to a function, and the function modifies that array, will the array be modified once you return from that function? Or does the function copy the array? And are you sure she took off points because the method was static? Did she just point an arrow with a question mark, or did she say "you should not have made this function static" without any reason as to why? If so, I would have talked to her personally and asked why she marked me down and then explained my point of view. Even teachers have off days and grade subjectively.
-
Gwenio wrote:
The teacher decided to take off a point because I wrote static in a method declaration.
Your teacher is an idiot. Will make you wonder when you reach access modifiers, if he will get that right...
xacc.ide
IronScheme - 1.0 RC 1 - out now!
((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition -
I'd have deducted another point because you used Java. Don't bother me with technicalities like "it's a Java course!"; I'm not interested. Hand the point over.
I wanna be a eunuchs developer! Pass me a bread knife!