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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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.
Transcribed Image Text: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.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Types of Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education