Required Skills Inventory Write a method that takes no arguments and returns a value ...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 () { <declare and initialize a variable to store the total cost for this table> <call your getNumberOfDinersAtTable method to get the number of diners ordering at this table> <loop while the number of diners ordering at this table is greater than zero> { <get this diner's order and store the total price of the items they ordered> <add this diner's total to the table total> <decrement the number of diners ordering at this table> } <compute and store the tax amount for this table's total (tax is 8% of table total) > <display the pre-tax table total for this table> <display the tax amount for this table> <display the suggested tip amounts for this table, by calling displaySuggestedTipAmounts> <return the total cost for this table (table total + tax) > Calling getTableOrder () might result in an interaction with the user that looks like this: 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 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 () { <declare and initialize a variable to store the total cost for this table> <call your getNumberOfDinersAtTable method to get the number of diners ordering at this table> <loop while the number of diners ordering at this table is greater than zero> { <get this diner's order and store the total price of the items they ordered> <add this diner's total to the table total> <decrement the number of diners ordering at this table> } <compute and store the tax amount for this table's total (tax is 8% of table total) > <display the pre-tax table total for this table> <display the tax amount for this table> <display the suggested tip amounts for this table, by calling displaySuggestedTipAmounts> <return the total cost for this table (table total + tax) > Calling getTableOrder () might result in an interaction with the user that looks like this: 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
Expert Answer:
Answer rating: 100% (QA)
Answer PART 1 Here is the code when called d isplays the following menu of food items 1 7 import jav... View the full answer
Related Book For
Java How To Program Late Objects Version
ISBN: 9780136123712
8th Edition
Authors: Paul Deitel, Deitel & Associates
Posted Date:
Students also viewed these programming questions
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
Prepare a personal SWOT analysis (Your personal Strengths and Weaknesses and the external macroeconomic Opportunities and Threats that all of your competitors will assess criteria examples Advantages...
-
Refer to the situation described in BE 20-10. Assume the error was discovered in 2020, after the 2019 financial statements are issued. Ignoring income taxes, what journal entry will PKE use to...
-
Carbon dioxide at P 1? and T 1 is contained inside a piston?cylinder. It undergoes polytropic compression according to the process equation PVn = constant.? a. Derive the formula for the energy...
-
Epic Systems is a Wisconsin health care software company. In 2014, Epic introduced a company policy that required employees to use individual arbitration in any disputes. Jacob Lewis, an Epic...
-
Calls arrive at Lynn Ann Fishs hotel switchboard at a rate of 2 per minute. The average time to handle each is 20 seconds. There is only one switchboard operator at the current time. The Poisson and...
-
(5) Strong Data Processing Inequality for the Divergence. Given finite alphabets X and Y, consider a conditional probability distribution W(y|x), for (x, y) Xxy, such that for some y. y, W (y, x) > c...
-
At January 1, 2024, M. E. Gainor Corporation had outstanding the following securities: The following additional information is available: On September 1, 2024, M. E. Gainor sold 72 million...
-
Select an organisation or industry you are familiar with. Identify and list 1 each of the following. Relevant communication channels used in your selected organisation or industry
-
Mike Derr Company expects to earn 10% per year on an investment that will pay $606,000 ten years from now. (PV of $1, FV of $1, PVA of $1, and FVA of $1) (Use appropriate factor(s) from the tables...
-
make a movie app similar to the example given below. I managed to get the tab layout and view pager to work but I don't know how to link any content to it. If you happen to know how to complete the...
-
Projects S and L are mutually exclusive. Draw their NPV profiles. Do your capital budgeting based on your NPV profiles. (6pts) After-tax, end of year cash flows Years 0 1 2 3 4 Total inflows Project...
-
Where is the Vendors center accessed in QuickBooks Online?
-
A small block slides down a frictionless track whose shape is described by y = ( x ^ 2 ) / d for x < 0 and by y = - ( x ^ 2 ) / d for x > 0 . The value of d is 4 . 6 4 m , and x and y are measured in...
-
Put a "T" for the true concept and an "F" for the false concept. 1. ___ Feudalism begins on the continent of Oceania with the fall of the Ottoman Empire. 2. ___ Serfdom is the form assumed by the...
-
Nate prepares slides for his microscope. In 1 day he prepared 12 different slides. Which equation best represents y, the total number of slides Nate prepares in x days if he continues at this rate? A...
-
Create a program that reads integer grades and stores them in an ArrayList, then use stream processing to display each grades letter equivalent (A, B, C, D or F). Response to comment: I assume it is...
-
Modify the application you wrote in Exercise 4.24 to read an odd number in the range 1 to 19 to specify the number of rows in the diamond. Your program should then display a diamond of the...
-
A bank offers college loans that can be repaid in 5, 10, 15, 20, 25 or 30 years. Write an app that allows the user to enter the amount of the loan and the annual interest rate. Based on these values,...
-
Describe the issues that you considered in each of these facets when you made a recent important purchase.
-
The area of a rectangle is calculated according to the following formula: Design a function that accepts a rectangles width and length as arguments and returns the rectangles area. Use the function...
-
Design a program that gives simple math quizzes. The program should display two random numbers that are to be added, such as: The program should allow the student to enter the answer. If the answer...
Study smarter with the SolutionInn App