• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

If Statement Help

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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]
 
Rancher
Posts: 600
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Found it......

Typo when closing the comments....had the * and the / reversed which commented out all of the code.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic