Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Required Skills Inventory Write a method that takes no arguments and returns a value Call one user-defined method from another Store the return value

imageimageimage

Required Skills Inventory Write a method that takes no arguments and returns a value Call one user-defined method from another Store the return value from a method in a variable Use a while loop to get the computer to repeat instructions Accumulate a total in a variable Output to console with System.out.print or System.out.println or System.out.printf Do not use any language features that have not been covered to this point in the course materials. Problem Description and Given Info . Pearl's Pancake Pad is a growing restaurant business. They would like to upgrade their existing pen-and-paper system for tracking tickets to a digital point of sale system. They are asking you to build that point of sale program for them. The point of sale program must: 1. Allow the waitstaff to input the item ordered by each diner at a given table Each table can seat up to 4 diners 2. For each diner at the table, the system must: } 1. Display a menu of at least 7 common breakfast items 2. Allow the waitstaff to enter the items the diner has ordered Each diner may order as many items as they want 3. After the orders for all diners at a table have been entered, the system must display: 1. total price for the whole table (pre-tax) 2. total tax for the whole table (tax is 8% of the total price) 3. suggested tip amounts for 10%, 15%, 20% and 25% tips for whole table (on the pre-tax total) 4. the program should continue to ask if there are more tables, and repeat the steps described above for each table. 5. After all table's orders have been processed, the program should print out the register total (total price + tax for all tables) for the day. Part 9 Design and write a public static method named getTableOrder. This method should take no arguments, and should return a double value (the total cost of all items ordered at this table plus tax). When called, this method should first ask the user for the number of diners at this table by calling the getNumberOfDinersAtTable method. Then the method should continue to get each diners order (by calling the getDinersOrder method) - collecting the total cost of all items ordered by the diners at this table. After all the diner's orders have been taken and their total costs accumulated, this method should compute the 8% tax for the table. This method should then display pre-tax total for the table, then the tax amount for the table, and then the suggested tip amounts for this table (based on the pre-tax table total). Finally, this method should return the total cost for this table (the table cost + the tax amount). Here is an outline of this method for you to follow and fill in. public static double getTableOrder () { { } Enter number of diners at this table: 2 1) eggs 2) bacon 3) pancakes 4) orange juice 5) oatmeal 6) milk 7) donut 1) eggs 2) bacon 3) pancakes 4) orange juice 5) oatmeal 6) milk 7) donut $3.25 $4.00 $2.50 Another item ('yes' or 'no') ? yes Enter a menu choice : 2 Another item ('yes' or 'no')? yes Enter a menu choice : 4 Another item ('yes' or 'no') ? no $1.25 $3.99 $1.25 $2.00 10% tip: 0.73 15 tip: 1.09 20% tip: 1.45 25% tip: 1.81 $3.25 $4.00 $2.50 $1.25 $3.99 $1.25 $2.00 Another item ('yes' or 'no')? yes Enter a menu choice : 7 Another item ('yes' or 'no') ? no. Table total: 7.25 Tax amount: 0.58 In the example above, the method would return the double value 7.83, because the total cost of the first diner's items (bacon and orange juice) plus the cost of the second diner's items (just a donut) is $7.25, and with an 8% tax amount of $0.58 added to that, the table total with tax comes to $7.83. You may wish to write some additional code to test your method. LAB ACTIVITY 1 import java.util.Scanner; 2 // import any necessary packages here below 3 4 public class Pearls { 5 6 7 8 00 0 9 9.26.1: Lab 07 (Part 09) - Pearl's Pancakes - Table Order BELLE 12 Pearls.java // use the following Scanner variable and object to collect any necessary user input public static Scanner scnr = new Scanner (System.in); 10 11 } public static void main (String[] args) { // write any code to test you method (s) here below 0/100 Load default template... 13 // define your method(s) here below 14 // include your displayMenu, dinerwantsAnotherItem, getMenuChoice, agetPriceOfMenuChoice, displaySuggested TipAm 15 16 17

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Answer PART 1 Here is the code when called d isplays the following menu of food items 1 7 import jav... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java How To Program Late Objects Version

Authors: Paul Deitel, Deitel & Associates

8th Edition

0136123716, 9780136123712

More Books

Students also viewed these Programming questions