Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using several IF-statements to calculate Packages

 
Alejandro Loaiza
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I'm on my last part of my assignment and I'm stuck on constructing a customers monthly statement if they go over the specific amount of hours they chose from the Packages and it would display the amount of money they would have saved if they chose Package B or Package C. That's only if they go over the hours. In my code, I seem to not be able to use:

if (hours < baseHours) from my internetServiceCharges() so I can calculate. The assignment question is this :

4. Challenge 14: The modifications to your program should be made entirely in main(). You must add statements to perform additional calculations, and extend the customer’s statement with additional information. You must use several if-statements. Test your program all over again to make sure it works as specified. For example:

Total Charges for 50 Package A hours: $89.95
A Package B Customer would have saved $46.0
A Package C Customer would have saved $70.0


I have been working on this for several hours and I broke down. I know the area where I am working at *I am flagging the code!* is off/wrong
because I need several IF's, but where??? I don't understand this at all. Would I be using IF ELSE here because one of my classmates said yes but it's not specified....?

This is my code and I'm extremely sorry if all of this looks like a major mess lol but please help me out with this last bit of code:


 
Tony Docherty
Bartender
Posts: 2969
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The simple answer is it's hard to do what you want with the way the code is structured. How much of this was given to you by your teacher as a template?

BTW Are you sure you are calculating the customer's total charges correctly?

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic