Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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 resultStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started