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
-
D2L Topic 6 Practice with solutions G efficiency of heat engine formu x D2L Quizzes - PHY1321*[B] Princip x C Course Hero G kinematic equations - Google S| +...
-
How can you as an ethical and global citizen, make a positive impact in the community? How would you motivate others to become involved in Service-Learning experiences? How does your values affect...
-
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...
-
Two products are obtained from the reaction of (Z)-2-pentene with water and a trace of H2SO4. The mass spectra of these products are shown in Figure 13.10. Identify the compounds responsible for the...
-
Assume Apple uses activity-based costing to allocate customer support costs to products. For a MacBook Pro model, assume Apple budgets annual customer support costs of $850,000. Also assume Apple...
-
Sony ('orp). launched its PlayStation 4 in late 2013. It was introduced at a price point of \(\$ 399\). At the time of introduction, a technology firm performed a tear-down of the PlayStation and...
-
The Neal Company wants to estimate next years return on equity (ROE) under different leverage ratios. Neals total assets are $14 million, it currently uses only common equity, and its...
-
Exercise 12-15 (Algo) Equity investments; fair value through net income [LO12-5] On March 31, 2021, Chow Brothers, Inc., bought 6% of KT Manufacturings capital stock for $53.9 million. KTs net income...
-
Sonora County is located in northern California and is known for its wine country and rugged Pacific coast line. Sonora is a rural county with only one major city, Santa Rita, which has a population...
-
Is Maslow's hierarchy of needs an still an accurate reflection of people's needs? In what ways does it reflect your individual needs or differ from your actual needs? Develop and suggest a revised...
-
Barack Obama's 2008 speech after losing the primary: Yes We Can. https://www.youtube.com/watch?v=Fe751kMBwms How does the speech use the other form of canon: arrangement, style, delivery, memory...
-
Discuss Tim Horton's motives for growing international and why China? Was a joint venture the best method of entry. Why or Why not? Provide your assessment on how Lu should best position and expand...
-
Answer these questions from below mentioned source https://austin.thinkbilingual.org/why-cross-cultural-communication-skills-are-vital-in-business/ S elect one source from Google you might use to...
-
3. Using the SML [LO11.4] Suppose the risk-free rate is 3 per cent and the expected return on the overall market is 9 per cent. If Chancer Ltd shares have a beta of 0.70, what is their expected...
-
Briefly describe two benefits of estimating measurements. Short Answer: Learner must briefly describe a minimum of two benefits of estimating measurements to achieve satisfactory achievement for this...
-
Dream Enterprises is a fully equity financed company and has 6 million shares outstanding with a market price of $10 a share. It announces that it intends to issue $30 million of debt and use 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,...
-
Average fixed cost equals _________ divided by the _________ produced.
-
Costs that are not fixed are called _________ costs.
-
The short-run total costs of a business fall into two distinct categories: _________ costs and _________ costs.
Study smarter with the SolutionInn App