C++ Part 1- Count your Many Pizzas • Prompt the user for how many guests to order for. • Determine and report the number of large, medium, and small pizzas you need to order. • For every 7 guests, order one large pizza. • For every 3 guests left over, order one medium pizza. • For every 1 guest left over, order one small pizza. Part 2 - Serving Size • Compute and report the total area of pizza (in square inches) you need to order. Do not round these values. • Compute and report the total area of pizza (in square inches) each guest can eat. Do not round these values. Part 3 - Supplementing the Budget • Prompt the user for the percent of the total price to be paid as a tip. The tip percentage will be input as a whole integer from 0 to 100. • Compute and report the total cost (including tip) of all the pizzas, rounding to the nearest dollar. Note: Changing the value type into an int alone will not round to the nearest dollar. See the end of the "Notes" section below.
This is the code I have so far:
#include <iostream>
#include<cmath>
//for round function
using namespace std;
void calculatePizza(int noOfGuests);
void calculatePizza(int noOfGuests){
//Declare the costs of each sized pizza
double largeCost=14.68,mediumCost=11.48,smallCost=7.28,guests=noOfGuests;
//number of large count pizzas
int largeCount=noOfGuests/7;
noOfGuests%=7;
//number of medium count pizzas
int mediumCount=noOfGuests/3;
noOfGuests%=3;
//number of smallcount pizas
int smallCount=noOfGuests;
//Find the cost of pizzas
double cost=largeCount*largeCost+mediumCount*mediumCost+smallCost*smallCount;
//Assuming the size of large size pizza is 30 , medium size pizza is 20 small size pizza is 10 sqinches
double size=largeCount*20+mediumCount*16+smallCount*12;
cout<<largeCount<<" large pizzas, "<<mediumCount<<" medium pizzas, "<<"and "<<smallCount<<" small pizzas will be needed."<<endl;
cout<<endl;
cout<<"A total of "<<size<< " square inches of pizza will be ordered ("<<size/guests<<" per guest)."<<endl;
cout<<endl;
int tipPercent;
cout<<"Please enter the tip as a percentage (i.e. 10 means 10%): "<<endl;
cin>>tipPercent;
double tip= round(cost*(tipPercent/100));
cout<<"The total cost of the event will be: $"<<cost+tip<<endl;
}
int main()
{
cout<<"Please enter how many guests to order for: "<<endl;
int noOfGuests;
cin>>noOfGuests;
calculatePizza(noOfGuests);
}
![C++
Part 1- Count your Many Pizzas
• Prompt the user for how many guests to order for.
• Determine and report the number of large, medium, and small pizzas you need to order.
• For every 7 guests, order one large pizza.
• For every 3 guests left over, order one medium pizza.
• For every 1 guest left over, order one small pizza.
Part 2 - Serving Size
• Compute and report the total area of pizza (in square inches) you need to order. Do not round these
values.
• Compute and report the total area of pizza (in square inches) each guest can eat. Do not round these
values.
Part 3 - Supplementing the Budget
• Prompt the user for the percent of the total price to be paid as a tip. The tip percentage will be input as a
whole integer from 0 to 100.
• Compute and report the total cost (including tip) of all the pizzas, rounding to the nearest dollar. Note:
Changing the value type into an int alone will not round to the nearest dollar. See the end of the "Notes"
section below.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F194b06c5-dd70-4efd-9aa0-ef9c12dc5586%2F25394b99-4ce6-4677-9fc9-cf4ac1807cda%2F6kafjlo.png&w=3840&q=75)
![](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F194b06c5-dd70-4efd-9aa0-ef9c12dc5586%2F25394b99-4ce6-4677-9fc9-cf4ac1807cda%2Fxf8mfte.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 3 steps with 1 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)