•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 456,463 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,746 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 423 | Replies: 3
![]() |
•
•
Join Date: Sep 2007
Posts: 9
Reputation:
Rep Power: 0
Solved Threads: 0
Hi. Please help. I can't seem to get this program to run.
Tips.java
Modify the exercise shown below so that it will loop, calculating a new tip each time until the user enters a value zero or smaller for the amount of the bill. Make sure there is a nice explanatory message printed at the beginning. Your user prompt should be "Enter the amount of the bill, enter 0 to quit".
You must use appropriate methods (and arguments in them), as well as final CONSTANTS where needed (such as for tipping percents.)
EXERCISE: Here is the beginning exercise (to which you’ll add the above enhancements:
Determine how much to tip in a restaurant. The minimum tip is one dollar.. The tipping levels should be 20% for superior service, 15% for OK service, and 10% if the service was not so good. You should request both the bill amount and the quality of the service. You may use numeric values if you explain to the user what tipping levels they correspond to. If the user doesn’t choose one of the three levels, use 15% as the default percent and also print a message informing the user that you are picking the default level.
Tips.java
Modify the exercise shown below so that it will loop, calculating a new tip each time until the user enters a value zero or smaller for the amount of the bill. Make sure there is a nice explanatory message printed at the beginning. Your user prompt should be "Enter the amount of the bill, enter 0 to quit".
You must use appropriate methods (and arguments in them), as well as final CONSTANTS where needed (such as for tipping percents.)
EXERCISE: Here is the beginning exercise (to which you’ll add the above enhancements:
Determine how much to tip in a restaurant. The minimum tip is one dollar.. The tipping levels should be 20% for superior service, 15% for OK service, and 10% if the service was not so good. You should request both the bill amount and the quality of the service. You may use numeric values if you explain to the user what tipping levels they correspond to. If the user doesn’t choose one of the three levels, use 15% as the default percent and also print a message informing the user that you are picking the default level.
•
•
Join Date: Nov 2006
Posts: 47
Reputation:
Rep Power: 2
Solved Threads: 1
think about what the program needs to do and how it should go about it there is going to be if loops involved
basic algorithm is get 2 user inputs both as ints or doubles
the first one is the total cost the second is an option.
then the if loops will be ur conditions for ur functions.
what part are you having problems with?
give it a try from here
basic algorithm is get 2 user inputs both as ints or doubles
the first one is the total cost the second is an option.
then the if loops will be ur conditions for ur functions.
what part are you having problems with?
give it a try from here
•
•
Join Date: Nov 2006
Posts: 47
Reputation:
Rep Power: 2
Solved Threads: 1
and sorry i forgot the whole thing is a while loop with either or with
while (true){
} while (x!=0){
}![]() |
•
•
•
•
•
•
•
•
DaniWeb Java Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Java 3D Environment (Java)
- Java 3D (Java)
- Java Expert (Needed) (Java)
- Java Chat Reboots (Java)
Other Threads in the Java Forum
- Previous Thread: mock credit card with mysql & filewriter
- Next Thread: General error


Linear Mode