Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Follow the requirements below to write a program that will calculate the price of ice cream being sold at a fundraiser: 1. Write a

 imageimageimageimage

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

Step by Step Solution

3.39 Rating (143 Votes )

There are 3 Steps involved in it

Step: 1

Heres the Java program implementing the requirements import javautilScanner public class IceCreamFundraiser Method to display ice cream type menu publ... 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