Question: You can use the following method for rounding a value to two digits after decimal point. This should be done with all money calculations that

 You can use the following method for rounding a value to

two digits after decimal point. This should be done with all money

You can use the following method for rounding a value to two digits after decimal point. This should be done with all money calculations that may have a result with > 2 digits after decimal point (Sales tax and total due).

static double round2(double d) { return Math.round(d * 100) / 100.0; } // end round2

sample run

calculations that may have a result with > 2 digits after decimal

in java use the method above

Functionality A restaurant patron orders a drink, an appetizer, a main dish (entre), and a dessert. This program would take the cost information for each item from the user and calculate the total amount to be paid by the customer, including the sale tax to be charged (at 7.25%) and tips. The program would also suggest how much the tip should be (at levels of 15%, 18%, 20% of total of food costs, not including the tax). The program would then ask how much tip the customer actually wishes to pay. This last value would then be used to display the total amount the customer should pay Program input/output The program should ask for the prices of each item the customer ordered. It would then show the suggested tip amounts at various levels and ask how much tip the customer wants to pay. It would then show the final output (a restaurant check), itemizing total food cost, sales tax, tip and the total due from the customer. It would include the name of the restaurant (defined as a named constant). See sample output. Use System.out.printf for formatted output. Choose a nice name for your restaurant. The sales tax rate should be defined as a named constant. The output from the program has two clear sections: The dialog with the user, and the displayed/printed check. These two sections should be separated by a horizontal line (a bunch of hyphens) Program Structure This is essentially a straight-line input-process-output (IPO) program. Identify the various parts of the program using section comments. The main method will do the following in sequence: 1. Print the output identification line CPS 150 Assignment 1 by your name 2. Have dialog with the user get server's first name, prices for drink, appetizer, entre and dessert 3. Calculate the total cost of the food items 4, Calculate and print the tip suggestions at 15%, 18%, and 20% 5. Prompt for and get the tip actually paid by the customer. 6. Calculate the Sales tax (7.25% of the total food price not including the tips) and the total due from customer (= total food price sales tax tips) Print the restaurant check separated from the user interaction by a line of hyphens, the check should be nicely formatted, as in the sample output 7. 8. Print the sign-off line Assignment 1 complete

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!