This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

If Statement Help

 
Raymond Owens
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
New to programming...trying to teach myself Java using (mostly) Objects First With Java.

Having trouble with an "if" statement in the exceedsBudget method. The compiler is returning a missing ";" error but I know there should not be a semi @ the end of the method header.

Thanks for any assistance!



[HENRY: Edit quote to code tags]
 
John de Michele
Rancher
Posts: 600
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raymond:

Welcome to JavaRanch!

Your problem resides on line 58.

John.
 
Raymond Owens
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John.....

I guess that's what happens when you stare at the same five lines of code for 20 minutes. Seems very obvious now .

Now that the code will compile without errors, BlueJ will not allow me to make a call (it's not even listed) to this same method. The syntax is the same as the insertMoney method which I can call up without issues.

Thanks so much for the help....

Ray
 
John de Michele
Rancher
Posts: 600
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raymond:

It may be because line 59 is ambiguous. I haven't used BlueJ, so I don't know its quirks, but it may be having issues with the fact that you have a class member called 'budget' and a local variable called 'budget'. Try renaming the variable at line 57 and change the variable name on line 59 to match it, and see if you can use the method then.

John.
 
Raymond Owens
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it must be an issue with BlueJ. I did as you suggested but no luck. Code compiles ok but the method still is not available to call.
 
Raymond Owens
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Found it......

Typo when closing the comments....had the * and the / reversed which commented out all of the code.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic