There is a list of compiler error messages here, but in my experience "illegal start of expression" has to do with pairing off {}. It usually means you have one more { than you think, or one } fewer; the compiler thinks you are still inside a method. Unfortunately, unlike some IDEs, JGrasp doesn't automatically pair off () [] and {}. Go back and count all your { and } and I think that will sort out your problem.
If you get the error with {} the other way round, it tens to say something like "class or interface expected."
From looking at just the error message, there seems to be a semicolon at an odd place...
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
it may just be the way the forum is displaying your code, but it's good programming practice to indent your code properly it's easier to read and helps a lot keeping the curly braces paired up correctly
Dave
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32833
4
posted
0
Posted by David Robbins
indent your code properly
The way to keep indentation on the forum is to use "code" tags, from the "code" button below the "message" box.
i edited your original post to take out the 'quote' tags, and put in 'code' tags. this restored the formatting/indentation.
I haven't spent much time looking at this, but i'm pretty sure you don't want this:
while (choice != 4);
it's either going to give you an infinite loop, or do nothing.
the error message is most likely because your braces are off. the second-to-last brace actually is closing your switch statement (which i'm pretty sure is long after you mean to close it), and the last brace currently closes your do-loop. make sure you have all the braces you need...
Never ascribe to malice that which can be adequately explained by stupidity.
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32833
4
posted
0
I think the (while choice != 4); bit is supposed to be the end of the "do-while" loop. I am still not sure the thing will work even when the braces are sorted out. I can't understand how the pourTo() method in the FishTank class works, though I can guess the addIn() method. There is also the risk of adding more water in the constructor than the tank will actually hold. There is more in the assignment which I think will lose marks.