Forums Register Login

Finished my so-called program with many errors

+Pie Number of slices to send: Send
So after a few days and countless hours just today i have finished my little program but have some major flaws, I am not asking for answers but more of a guidance towards where I am suppose to be, I feel i am in the ball park concerning this but cant put 2 and 2 together. I will be up a couple more hours, and then again tommorrow after work but please feel free to lend a hand.

Here goes 78 errors of pure bliss according to Jcreator:



EDIT by mw: Added Code Tags.
[ September 24, 2007: Message edited by: marc weber ]
+Pie Number of slices to send: Send
You should seriously consider compiling as you go. Write a few lines, then compile. If you have errors, fix them when they're small. When it compiles without errors, then write a few more lines and compile again... And so on.

I think that's your best shot at debugging this code. Break it down to just a few lines, and gradually add more lines as you fix the errors. (As you do this, you will find that Java does not have an "endIf." Use braces for this. Also, "call" is not a keyword.)

PS: Please use Code Tags when posting code. Thanks!
[ September 24, 2007: Message edited by: marc weber ]
+Pie Number of slices to send: Send
If you have reproduced your code exactly here on this forum,I can see two mistakes for sure.

1) When you compile and try to run a java program,the execution of the program starts from main method.You have not defined a main method in your program.Of course that will not cause a compile time error.Absence of main method will not cause execution of the program at run time.

2)
You entered--

private StagIO io = new StaugIO();

Apparently you are trying to create a new object of the class type StaugIO but on the left hand side you are defining object belonging to class type StagIO. You can do this only if StagIO is a superclass of StaugIO class.But from your code, it does not seem to be.

See if this helps.

----Girish
+Pie Number of slices to send: Send
I have lowered my errors from 78 to 41 which to me is an improvement but I am still getting multiple errors that include the folllowing:

while expected
illegal start of expression
';' expected
not a statement
'(' expected
')' expected
not a statement
';' expected
illegal start of type
not a statement
not a statement
'(' expected
')' expected
';' expected
';' expected
'(' expected
')' expected
'(' expected
')' expected
'(' expected
')' expected
'(' expected
')' expected
'(' expected
')' expected
'(' expected
')' expected
'(' expected
')' expected
'(' expected
')' expected
';' expected
';' expected
';' expected
not a statement
';' expected
'else' without 'if'
<identifier> expected
<identifier> expected
class, interface, or enum expected
class, interface, or enum expected


+Pie Number of slices to send: Send
Most of those errors are pretty descriptive, telling you exactly what you're missing. I assume that they also provide a line number. So knowing what line is missing what... You just need to take one error at a time. If you can't figure them out, tell us exactly what error is happening at exactly which line in the code.

(Again: Neither "endIf" nor "call" are keywords in Java. These have no meaning and will cause errors.)
[ September 25, 2007: Message edited by: marc weber ]
+Pie Number of slices to send: Send
I have got it down to 15 errors but I really feel somethings I did werent right but it still let it pass when i compiled it. I dont understand the while part also the illegal starts and on line 56 i know I am completely lost because I cant even figure out where to place the ( ) at


while expected LINE 41
illegal start of expression LINE 42
not a statement LINE 52
'(' expected LINE 56
')' expected LINE 56
not a statement LINE 56
';' expected LINE 56
illegal start of type LINE 56
not a statement LINE 56
illegal start of expression LINE 65
'else' without 'if' LINE 168
<identifier> expected LINE 169
<identifier> expected LINE 170
class, interface, or enum expected LINE 181
class, interface, or enum expected LINE 196

I dont mean to be a bore but here is my program again with the only 15 errors:


[ September 25, 2007: Message edited by: Reno Madrigal ]
+Pie Number of slices to send: Send
any advice?
+Pie Number of slices to send: Send
As Marc said, it's much easier for you to figure out what's going wrong, since you have the line numbers.

One thing I noticed is that you seem to assume that in a switch statement, execution of a case ends at the next case statement. That's not the case; if you want execution to stop at the next case statement, you need to insert a "break;" before it.
+Pie Number of slices to send: Send
Not trying to be rude, but it's good that you learn the Java syntax first before your start coding. Here's a pretty good link:
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/index.html

Anyway, good luck
+Pie Number of slices to send: Send
There's no "endIf" in Java.

This is wrong for two reasons:

The while condition must be inside of the parentheses, and equality is tested using "==", not "=".
+Pie Number of slices to send: Send
you have a "do" that is not followed by braces {}. that means that only one line belongs in the do-body. java is expecting a while after that one line. you probably need braces around a big chunk of code between your 'do' line and your 'while' line (which Ulf points out also needs correcting).
See where your hand is? Not there. It's next to this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1015 times.
Similar Threads
Java Collections- Retrival from nested while loops
Assignment does not make sense to me.
class/interface/enum errors
Exception in Thread-Inventory Program
Declaring Multiple Private Variables
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 02:35:39.