Follow the requirements below to write a program that will calculate the price of ice cream...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Follow the requirements below to write a program that will calculate the price of ice cream being sold at a fundraiser: 1. Write a method that displays a menu. The method should ask the user to enter a menu selection. Input Validation: The method should accept only a number between 1 and 3. If the user's input is not valid, the method should force the user to re-enter until a valid value is entered. This method should accept no arguments. The method should return the menu selection. See the sample input/output for the required wording and format of the menu. 2. Write a method that accepts one argument: the menu selection. The method should return the price per scoop of the ice cream. The price per scoop can be calculated using the information below: Ice Cream Type Chocolate Vanilla Strawberry Price per Scoop $2.79 $2.69 $2.75 3. Write a method that asks the user to enter the number of scoops of ice cream being purchased. Input Validation: The method should not accept a number less than 1 for the number of scoops. If the user's input is not valid, the method should force the user to re- number of scoops. If the user's input is not valid, the method should force the user to re- enter until a valid value is entered. The method should accept no arguments. The method should return the number of scoops. 4. Write a method that calculates the price of a purchase. This method should accept two arguments: the price per scoop and the number of scoops purchased. The method should return the price of a purchase. Note: the calculation is not provided. You must create the calculation. 5. Display the price of the purchase. See the sample input/output. 6. Calculate the total cost of all the purchases. 7. The program should ask whether the user wants to process another purchase. If so, it should repeat the tasks above. o If not, it should display the discounted total cost of all the purchases (see step 8) and terminate. The program should work with either an upper or lower case letter (example: Y or y). - See the sample input/output. 8. Write a method that displays the discounted total cost of all the purchases. The method should accept one argument: the total cost of all the purchases. The method should not return a value. See the sample input/output. The discounted total cost can be calculated using the information below: NOTE: Total Cost Under $10.00 At least $10.00 but under $20.00 $20.00 and above The discounted total cost can be calculated as follows: Percent Discount Discounted Total Cost = Total Cost * (1 - Percent Discount/100) 0 5% 10% All methods should be coded as instructed above. Modifying the methods (adding or removing parameters, changing return type, etc...) will count as a major error. Ice Cream Type Menu You should call the methods you created above from the main method. The output of the program (including spacing and formatting) should match the sample input and output shown below. Sample Input and Output (include spacing as shown below) Sample Input and Output (include spacing as shown below) Ice Cream Type Menu 1. Chocolate 2. Vanilla 3. Strawberry Select the type of ice cream from the list above: 1 Enter the number of scoops that were purchased: 3 The total price of the purchase is: $8.37 Do you wish to process another purchase (Y/N)? y Ice Cream Type Menu 1. Chocolate 2. Vanilla 3. Strawberry Select the type of ice cream from the list above: 3 Enter the number of scoops that were purchased: 3 The total price of the purchase is: $8.25 V=0&bp=0&ou-89 2. Vanilla 3. Strawberry Select the type of ice cream from the list above: 1 Enter the number of scoops that were purchased: 3 The total price of the purchase is: $8.37 Do you I wish to process another purchase (Y/N)? y Ice Cream Type Menu 1. Chocolate 2. Vanilla 3. Strawberry Select the type of ice cream from the list above: 3 Enter the number of scoops that were purchased: 3 The total price of the purchase is: $8.25 Do you wish to process another purchase (Y/N)? N The discounted total cost of all the purchases is $15.79 Follow the requirements below to write a program that will calculate the price of ice cream being sold at a fundraiser: 1. Write a method that displays a menu. The method should ask the user to enter a menu selection. Input Validation: The method should accept only a number between 1 and 3. If the user's input is not valid, the method should force the user to re-enter until a valid value is entered. This method should accept no arguments. The method should return the menu selection. See the sample input/output for the required wording and format of the menu. 2. Write a method that accepts one argument: the menu selection. The method should return the price per scoop of the ice cream. The price per scoop can be calculated using the information below: Ice Cream Type Chocolate Vanilla Strawberry Price per Scoop $2.79 $2.69 $2.75 3. Write a method that asks the user to enter the number of scoops of ice cream being purchased. Input Validation: The method should not accept a number less than 1 for the number of scoops. If the user's input is not valid, the method should force the user to re- number of scoops. If the user's input is not valid, the method should force the user to re- enter until a valid value is entered. The method should accept no arguments. The method should return the number of scoops. 4. Write a method that calculates the price of a purchase. This method should accept two arguments: the price per scoop and the number of scoops purchased. The method should return the price of a purchase. Note: the calculation is not provided. You must create the calculation. 5. Display the price of the purchase. See the sample input/output. 6. Calculate the total cost of all the purchases. 7. The program should ask whether the user wants to process another purchase. If so, it should repeat the tasks above. o If not, it should display the discounted total cost of all the purchases (see step 8) and terminate. The program should work with either an upper or lower case letter (example: Y or y). - See the sample input/output. 8. Write a method that displays the discounted total cost of all the purchases. The method should accept one argument: the total cost of all the purchases. The method should not return a value. See the sample input/output. The discounted total cost can be calculated using the information below: NOTE: Total Cost Under $10.00 At least $10.00 but under $20.00 $20.00 and above The discounted total cost can be calculated as follows: Percent Discount Discounted Total Cost = Total Cost * (1 - Percent Discount/100) 0 5% 10% All methods should be coded as instructed above. Modifying the methods (adding or removing parameters, changing return type, etc...) will count as a major error. Ice Cream Type Menu You should call the methods you created above from the main method. The output of the program (including spacing and formatting) should match the sample input and output shown below. Sample Input and Output (include spacing as shown below) Sample Input and Output (include spacing as shown below) Ice Cream Type Menu 1. Chocolate 2. Vanilla 3. Strawberry Select the type of ice cream from the list above: 1 Enter the number of scoops that were purchased: 3 The total price of the purchase is: $8.37 Do you wish to process another purchase (Y/N)? y Ice Cream Type Menu 1. Chocolate 2. Vanilla 3. Strawberry Select the type of ice cream from the list above: 3 Enter the number of scoops that were purchased: 3 The total price of the purchase is: $8.25 V=0&bp=0&ou-89 2. Vanilla 3. Strawberry Select the type of ice cream from the list above: 1 Enter the number of scoops that were purchased: 3 The total price of the purchase is: $8.37 Do you I wish to process another purchase (Y/N)? y Ice Cream Type Menu 1. Chocolate 2. Vanilla 3. Strawberry Select the type of ice cream from the list above: 3 Enter the number of scoops that were purchased: 3 The total price of the purchase is: $8.25 Do you wish to process another purchase (Y/N)? N The discounted total cost of all the purchases is $15.79
Expert Answer:
Answer rating: 100% (QA)
Heres the Java program implementing the requirements import javautilScanner public class IceCreamFundraiser Method to display ice cream type menu publ... 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
-
You have been hired by a file hosting streaming service to write a program that will calculate the cost of a user to store and stream audio files. The streaming platform hosts two types of audio...
-
Write code using struct-defined data types Organize source code in multiple header and implementation files (.h and .cpp files). Create, initialize, read, update, and display the contents of struct...
-
You are the manager of a large car dealership. At present, you rely on a large pool of dealers to sell your product, but you have noticed recently that consumer opinion appears to be turning away...
-
Jack and Jill filed a joint return in 2014 showing Jill's wages of $50,000 and Jack's self-employment income of $30,000. Jack and Jill divorced in 2015. In 2016, the IRS audited their return and...
-
If we accept the Sharpe model as a description of expected returns, using the data in Table 16.1, find the expected return on a stock in the construction industry with the following characteristics....
-
Why is the section of the periodic table labeled as "transition elements" exactly 10 elements wide in all rows?
-
Plenair, Inc., is located in France and organizes and coordinates art shows and auctions throughout the world. Its budgeted and actual costs for last year follow. Because the company sells only...
-
Create a post sharing a setback you've faced related to your business. If you haven't created your company yet, you can share a personal example. Were you able to respond to this setback with...
-
Darden Restaurants, Inc. (DRI) is the largest full-service restaurant company in the world. It operates over 2,200 restaurants under a variety of brand names, including Olive Garden, Bahama Breeze,...
-
Draw the least squares regression line and write a linear equation that "best fits" the data in the table shown below. Compute also the R. Hours Spent on Grade Essay 6 82 10 88 2 56 4 64 6 77 7 92 0...
-
Use data to describe what makes Toyota Motor Corporation a multinational corporation. Provide an economic rationale that links the growth or success of the company with one of the trade theories...
-
here is the data for the United States from the World Bank : GDP (PPP): 22.675 trillion USD (2020) GDP Growth Rate: 5.7% (2021) Per Capita GDP: 68,309 USD. (2020) GDP % composition by sector...
-
In what ways can students and logistics professionals engage in proactive measures to foster meaningful connections and collaborations with Indigenous makers, ensuring cultural sensitivity, mutual...
-
Trading Stock is defined in a 70-10(1) ITAA 1997 as anything produced, manufactured, acquired that is held for the purposes of manufacture, sale or exchange in the ordinary course of business....
-
Problem 2: Location Choice. Oklahoma City currently has an NBA team (the Thunder). Demand for Thunder games in Oklahoma City is given by: Pok (Qok) 490-22 ok Seattle does not currently have an NBA...
-
I A volume of 20 mL of 0.0282 N AgNO, was required to titrate 1 mL of saline water in the API test for salinity. Determine the con- centration of CI and NaCI in the solution in mg/L assuming only...
-
Suppose that the laptop of Prob. 2.16 is placed in an insulating briefcase with a fully charged battery, but it does not go into sleep mode, and the battery discharges as if the laptop were in use....
-
Every additional line of code is an opportunity for a defect. Discuss the ways in which inheritance promotes defect reduction.
-
The Fibonacci series 0, 1, 1, 2, 3, 5, 8, 13, 21, begins with the terms 0 and 1 and has the property that each succeeding term is the sum of the two preceding terms. a) Write a method fibonacci(n)...
-
Modify the postfix evaluator program of Exercise 21.13 so that it can process integer operands larger than 9. Exercise 21.13 Write class PostfixEvaluator that evaluates a postfix expression such as 6...
-
A network for a process plant is shown in Fig P19.7. (a) Calculate the energy targets for \(\Delta T_{\min }=10{ }^{\circ} \mathrm{C}\) and show a design that achieves these targets. (b) Explain why...
-
The emf of a copper-iron thermocouple caused by the Seebeck effect, with a cold junction at \(0{ }^{\circ} \mathrm{C}\), is given by \[\varepsilon=\alpha_{1} t+\frac{\alpha_{2}}{2}...
-
The emf of a copper-iron thermocouple with its cold junction at \(0{ }^{\circ} \mathrm{C}\) is given by \[\varepsilon=-13.403 t+0.0138 t^{2}+0.0001 t^{3} \quad \mu \mathrm{V}\] where \(t=\)...
Study smarter with the SolutionInn App