Question: In this programming assignment, you will write program that determine the price of circulate pizza and display the total price and tax. The price per
In this programming assignment, you will write program that determine the price of circulate pizza and display the total price and tax.
The price per unit area is $0.55.
The price per topping is $1.25.
The radius of the pizza is equal to the size (1 for small, 2 for medium and 3 for large) multiplied by a factor of 1.15. The default size is 1.
The area of the pizza is 3.1414 multiplied by the square of the radius.
The pizza area price is area multiplied by unit area price multiplied by the quantity ordered.
The toppings price is the number of toppings multiplied by the price per topping multiplied by quantity ordered. The default number of toppings is 1.
The sale price is the sum of pizza area price and the toppings price.
The tax rate is either 5% or 8.5%.
The total price is equal to the sale price plus tax.
Your program should have the following (document each statement). Use your own variable names, preferably the camelCase style.
Define a variable for the price per unit area and assign $0.55 to it.
Define a variable for the price per topping and assign $1.25 to it.
Define a variable for the constant in area and assign 3.1414 to it.
Define two variables for two tax rates and assign 8.5% and 5% to them.
Define a variable for the radius constant and assign 1.15 to it.
Prompt the user to enter the pizza size (an integer) and assign to a variable.
If the user entered value other than 1, 2, or 3, set the pizza size to 1.
Write an expression for the pizza radius and assign to a variable.
Write an expression for the pizza area and assign to a variable.
Prompt the user to enter the number of toppings (an integer) and assign to a variable.
If the number of toppings entered is less than 0 or greater than 8, set the number of toppings to 1.
Prompt the user to enter the quantity of pizza ordered (an integer) and assign to a variable.
The maximum quantity is 50. If a negative quantity entered, set the quantity to 1 and if the quantity entered is greater than 50, set the quantity to 50.
Write an expression for the pizza area price and assign to a variable.
Write an expression for the toppings price and assign to a variable.
Write an expression for the sale price and assign to a variable.
Write an expression for the tax and assign to variable. Use a tax rate of 8.5% if the sale price is greater than $100 and 5% otherwise.
Write an expression for the total price and assign to variable.
Display the pizza area price (to two decimal places).
Display the toppings price (to two decimal places.
Display the sale price (to two decimal places).
Display the tax (to two decimal places).
Display the total price (to two decimal places).
A run of your program will look like (this display uses rates different from above):
Run #1
Enter pizza size 1 for small 2 for medium 3 for large: 2
Enter the number of toppings: 3
Enter the number of pizza: 2
Pizza Area Price is $18.28
Toppings Price is $2.1
Sale Price is $20.38
Tax is $1.73
Total Price is $22.11
Run #2
Enter pizza size 1 for small 2 for medium 3 for large: 3
Enter the number of toppings: 5
Enter the number of pizza: 4
Pizza Area Price is $82.26
Toppings Price is $4.2
Sale Price is $86.46
Tax is $7.35
Total Price is $93.81
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
