Question: JAVA CODING Calculate pizza order. Assumption: Customer orders only one pizza. Cheese pizza is $10. Toppings are normally $2 each. However, when three or more

JAVA CODING

JAVA CODING Calculate pizza order. Assumption: Customer orders only one pizza. Cheese

Calculate pizza order. Assumption: Customer orders only one pizza. Cheese pizza is $10. Toppings are normally $2 each. However, when three or more toppings are ordered, then toppings cost $1.5 for each. Orders over $16 receives 10% discount. Write a program to accept an input INTEGER for the number of toppings and print the total cost to screen. Solution Steps: Inputs and Variables: 1) The number of topping(s) (User input) Optional (Programming can be done in various ways, you may choose your own way) 2) Declare a variable named each Topping Cost and assign 2 (because each topping cost is $2 unless more than 3 toppings are ordered). 3) Declare a variable to hold the pizza cost, assign 10 into it. Because if no toppings are ordered, then the customer wants to order only cheese pizza. What to Do: 1) Check the number of topping(s) that the user enters a) If it is at least three, then assign 1.5 to the variable each Topping Cost b) Otherwise option is not needed since each Topping Cost already has the value 2. (see the step2 above) 2) Calculate the cost => cost = cost + each Topping Cost*numberOfTopping 3) Check if the cost is greater than 16, if so, apply 10% discount. 4) Display the result

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!