You've decided to order a pizza for dinner. The restaurant you're ordering from has three sizes of pizza: S, M, and L. Each size has a different base price and price per topping. The prices are indicated in the table below. Create a program to calculate the total cost of your pizza. The program should prompt you for the size of pizza and the number of toppings, then output the cost. Size Base Price $4.99 S M L $5.99 $6.99 Price per Toppings $0.75 $1.50 $2.25 The input should be a character (for size) and non-negative integer (for number of toppings) and the output should be a double. Sample run: What size pizza would you like to order? S How many toppings do you want? 3 Your total is $7.24 Note: The total cost should be formatted with a two-digit precision. You can use the setprecision () function with the fixed manipulator from library to do so. Bad formatting: 10.8 Good formatting: $10.80 Ensure you are doing input validation similar to the last question. If the user inputs something they cannot, output Please enter a valid input. and exit.
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
You've decided to order a pizza for dinner. The restaurant you're ordering from has three sizes of pizza: S, M, and L. Each size has a different base price and price per topping. The prices are indicated in the table below. Create a program to calculate the total cost of your pizza. The program should prompt you for the size of pizza and the number of toppings, then output the cost.
Size | Base Price | Price per Toppings |
---|---|---|
S | $4.99 | $0.75 |
M | $5.99 | $1.50 |
L | $6.99 | $2.25 |
The input should be a character (for size) and non-negative integer (for number of toppings) and the output should be a double.
Sample run:
What size pizza would you like to order? S How many toppings do you want? 3 Your total is $7.24
Note: The total cost should be formatted with a two-digit precision. You can use the setprecision() function with the fixed manipulator from <iomanip> library to do so.
Bad formatting: 10.8
Good formatting: $10.80
Ensure you are doing input validation similar to the last question. If the user inputs something they cannot, output Please enter a valid input. and exit.
Make sure to submit your code on Coderunner (accessed through Canvas) as well as the final Zip file submission.
The file should be named pizza.cpp
![You've decided to order a pizza for dinner. The restaurant you're ordering from has three sizes of pizza: S, M, and L. Each size has a
different base price and price per topping. The prices are indicated in the table below. Create a program to calculate the total cost of your
pizza. The program should prompt you for the size of pizza and the number of toppings, then output the cost.
Size Base Price Price per Toppings
$4.99
$0.75
$5.99
$1.50
$2.25
S
M
L
$6.99
The input should be a character (for size) and non-negative integer (for number of toppings) and the output should be a double.
Sample run:
What size pizza would you like to order?
How many toppings do you want?
3
Your total is $7.24
Note: The total cost should be formatted with a two-digit precision. You can use the setprecision () function with the fixed manipulator from
<iomanip> library to do so.
Bad formatting: 10.8
Good formatting: $10.80
Ensure you are doing input validation similar to the last question. If the user inputs something they cannot, output Please enter a valid
input. and exit.
Make sure to submit your code on Coderunner (accessed through Canvas) as well as the final Zip file submission.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F840f535b-f075-49f5-9fe8-c5a30f6f8dd7%2F9c85ddb5-30f1-4b97-807c-d8384b5cea22%2Faviqrtn_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)