Forums Register Login

my first Java nightmare

+Pie Number of slices to send: Send
I'm trying another route. Should this work?

+Pie Number of slices to send: Send
That looks fine to me. (By fine I mean it looks like it should work). Does it work like you expected it to?

IMO going through those "Java nightmares" just makes you stronger (to rewrite a tired cliche'). The next time, you will understand the pitfalls involved with this lesson. Especially with things like variable scope and shadowing primitive variables and such.

Garrett
[ February 10, 2006: Message edited by: Garrett Rowe ]
+Pie Number of slices to send: Send
It still isnt working. I'm getting some weird ')' and '}' expected, for which I can't figure out where they should go. So I'm moving on to the next exercise, then maybe come back to this fresh (hopefully).
+Pie Number of slices to send: Send
This declaration:

static void printEmployeeInfo(StringBuffer employeeName, Double hourlyRate, Double hoursWorked, Double taxRate, Double pay[0], Double pay[1]) { ...

is causing the errors. The fact that you're passing array elements as arguments to this routine is irrelevant; when you declare the routine, you declare the arguments as plain old Doubles. The "Double pay[0]" syntax is what's wrong; you just want "Double pay0, Double pay1" or something like that (I don't know what those two elements represent or I'd give the parameters better names.)
+Pie Number of slices to send: Send
 

Originally posted by Jesse Crockett:
It still isnt working. I'm getting some weird ')' and '}' expected, for which I can't figure out where they should go. So I'm moving on to the next exercise, then maybe come back to this fresh (hopefully).



First of all, don't worry about the tons of errors messages from the compiler. Deal with it one at at time. Fix one, then compile again. With experience later, you'll learn to do more than one.

Second, the most important items with the error message is the file and line number. Get a good editor, open the file specified, go to the line specified, and start from there. Errors having to do with braces are generally cause eariler -- so you may have to back up a bit. Having an editor that will help you match braces, would be a good idea too. Again, this will improve with experience.

Henry
+Pie Number of slices to send: Send
hmmmm, shouldn't an array be initialized as:

int [] myArray = {1,2,4}//use{} instead of ()
A feeble attempt to tell you about our stuff that makes us money
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 800 times.
Similar Threads
Constructor Problem
Problem with looping... Arg
question about variables changed inside methods
Need help with structure...
problem with StringBuffer and Double
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 09:20:51.