• Post Reply Bookmark Topic Watch Topic
  • New Topic

Missing a ')' somewhere...but where?  RSS feed

 
Lisa Beglaw
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The if line highlights yellow (in blueJ) and gives me an error message ")" expected.

But it looks right to me? What am is missing?
 
Abdulla Mamuwala
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you declaring pickAYear multiple times to be of type integer.
Isn't it okay to declare the local variable pickAYear once here,
 
Lisa Beglaw
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm...not really sure. I thought that was how they showed us.

But even if I remove the:
int pickAYear = -1;

I still get the missing a bracket error.
 
Joyce Lee
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Lisa,

Here is the correct version:



Joyce
 
Lisa Beglaw
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joyce & Abdulla -- THANK YOU!!! Again, just another stupid mistake.

Abdulla -- Sorry, I misunderstood what you meant. NOW I get it. Sorry.

Thanks, Lisa
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Call me pedantic, but isn't this easier to read (esp for a beginner)?

I just found that on the original version I had to pause for a second or two just to be really sure what it did.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Stuart Gray:
Call me pedantic, but isn't this easier to read (esp for a beginner)?

I just found that on the original version I had to pause for a second or two just to be really sure what it did.


This version isn't logically equivalent to the original one (ignoring the spurious "int" keyword). Although, I think it is what is actually needed.

Layne
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Layne, could you explain how it is different please? It looks right to me, though I may stand corrected of course.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!