well, when i try to add the stuff it makes ot worse
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
well, when i try to add the stuff it makes ot worse
Add what "stuff"? You need to be more specific in your answers.
Which error are you working on?
Wishes Ada xx
If to Err is human - then programmers are most human of us all.
"The Analytical Engine offers a new, a vast, and a powerful language . . .
for the purposes of mankind."
— Augusta Ada Byron, Lady Lovelace (1851)
i add braces and it makes it worse
Where are you adding your braces? To which part(s) of the code?
Wishes Ada xx
If to Err is human - then programmers are most human of us all.
"The Analytical Engine offers a new, a vast, and a powerful language . . .
for the purposes of mankind."
— Augusta Ada Byron, Lady Lovelace (1851)
the end of the quoted line like mine says to
Can you post the code with the updates? It's impossible
to guess what is going on without any visual aid. Also
comment the line(s) that have errors when you compile it
and if possible the errors also.
Wishes Ada xx
If to Err is human - then programmers are most human of us all.
"The Analytical Engine offers a new, a vast, and a powerful language . . .
for the purposes of mankind."
— Augusta Ada Byron, Lady Lovelace (1851)
String bottlewordString(int bottleNumber);
What does the error message actually say? If that
is a method parameter, then it should not have the
semicolon. Can you not show more code than that?
Wishes Ada xx
If to Err is human - then programmers are most human of us all.
"The Analytical Engine offers a new, a vast, and a powerful language . . .
for the purposes of mankind."
— Augusta Ada Byron, Lady Lovelace (1851)
the error message says (exact)
error: ';' expected
String bottlewordString(int bottleNumber);
^
Going by the last piece of code you posted:
* why are there semicolons after your 'if' statements?
* Have you solved the "class needs to be in own file" error?
* Again - the semicolon after the method parameter is going to cause errors.
Wishes Ada xx
If to Err is human - then programmers are most human of us all.
"The Analytical Engine offers a new, a vast, and a powerful language . . .
for the purposes of mankind."
— Augusta Ada Byron, Lady Lovelace (1851)
i thought i needed the semicolons and i havent solved the second problem. on the last one i thought i needed the semicolon because of the error message.
If you put semicolons after an 'if' statement, the program is always
going to evaluate the statement as true - or preform some other
undefined behaviour.
Putting a semicolon after a method parameter should always cause
a logic or compilation error. If you place the BeerSong class in it's
own file (which was the first problem) most of the errors will be
easier to understand.
Wishes Ada xx
If to Err is human - then programmers are most human of us all.
"The Analytical Engine offers a new, a vast, and a powerful language . . .
for the purposes of mankind."
— Augusta Ada Byron, Lady Lovelace (1851)
lucas29 (July 31st, 2014)
i think that'll help me, thank you
Nope, not true and the behaviour will always be defined.
This will never be true regardless if the semicolon is there or not. However the presence of the semicolon signals the end of the if statement. The below code is the equivalent.if(3 == 5);
This effectively says if the condition is true do nothing. What causes the confusion is that the code following the semicolon (which people assume is inside the if statement) is actually outside the if statement and will always be executed regardless of the condition in the if statement.if(3 == 5) { ; }
Improving the world one idiot at a time!
Ada Lovelace (August 1st, 2014)
um, so what do u want me to do?
What we want you to do: Read and apply the advice given, make progress, report back with your results, updated code, new errors, and new questions. We've been over this before. We're not going to write it for you.
Is this a college assignment? If so when is/was it due?
You have been working on this for over two weeks now at
least.
Have you spoken to your professor or teaching assistant about it?
Have you been given extensions or guidelines to follow?
Read the assignment question from the text book and try to work it
out on pen and paper first. If you work out what is supposed to happen,
write it in pesudocode (spelling?). Then slowly translate that code into
executable Java statements. Follow the guidelines from Greg, myself and
others.
Wishes Ada xx
If to Err is human - then programmers are most human of us all.
"The Analytical Engine offers a new, a vast, and a powerful language . . .
for the purposes of mankind."
— Augusta Ada Byron, Lady Lovelace (1851)
i have no teacher, except a book
Have you made any progress since the last problems?
Are you getting any new errors or problems? Have you
resolved any of the ones posted previously?
Wishes Ada xx
If to Err is human - then programmers are most human of us all.
"The Analytical Engine offers a new, a vast, and a powerful language . . .
for the purposes of mankind."
— Augusta Ada Byron, Lady Lovelace (1851)