Question: PLEASE ANSWER THIS QUESTION IN JAVA A bakery sells three types of muffins whose prices are as follows: 1- blueberry muffin, $2.98; 2- chocolate chip
PLEASE ANSWER THIS QUESTION IN JAVA
A bakery sells three types of muffins whose prices are as follows:
1- blueberry muffin, $2.98;
2- chocolate chip muffin, $4.50 and
3- banana muffin, $9.98.
Write an application that reads a series of pairs of numbers as follows: -muffin number (1 for blueberry one,2 for chocolate chip one, or 3 for banana one) -quantity sold - use 0 to terminate input
Your program should use a switch statement to determine the retail price for each muffin.
It should calculate and display the total retail value of all muffins sold.
Use a sentinel-controlled loop to determine when the program should stop looping and display the results.
Additionally, add an if-else statement to check whether user enters 0,1,2, or 3 and ask user to enter a number which can be 0,1,2, or 3 in the case of another number is entered.
For example; if a user enters 4, the program will ask him to enter the numbers that can be only 0,1,2, or 3.
For example: User enters 1 and quantity is 30, enters 2 and quantity is 20, user enters 1 and quantity is 20, enters 3 and quantity is 20, enters 0 Print: Total retail value of all muffins sold is 438.60 Calculation= (2.98*30 + 4.50*20 + 2.98*20+9.98*20) = 89.40+90.00+59.60+199.60= 438.60
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
