Question
C++ Part 1 - Count your Many Pizzas Prompt the user for how many guests to order for. Determine and report the number of large,
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 smallpizzas 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 paidas a tip. The tip percentage will be input asa whole integer from 0 to 100.
- Compute and report the total cost (including tip) of all thepizzas, rounding to the nearest dollar. Note: Changing the valuetype into an int alone will not round to the nearest dollar. Seethe end of the "Notes" section below.
Part 4 - The "Magic" of Avoiding Magic Numbers
Sometime it may feel like a nuisance to make sure to properlyuse constants for magic numbers, so here we give you theopportunity to see how useful it can be. By changing just some ofthe constants, your program can simulate any pizza sizes andprices, without having to touch any other part of your code. Thoseconstants are how many people each pizza feeds, the dimensions ofeach pizza, and the cost of each pizza. Make sure that you havewritten your code so that by changing only those nine values, andre-compiling, you can simulate any arbitrary pizza values.
Since you will be changing constants and recompiling for Part 4,you will be submitting a different compiled program than used inParts 1, 2, and 3. Thus, do not submit the updated program here.Instead, copy your program from here into the following zyBooksection (Main Lab 2B), change 9 of your constants, and submit theprogram from there. The grading TA will combine the points from theauto-grade of both 2A (possible 85 points) and 2B (possible 15points) to get your full auto-grade points. The new values you willuse are given in section Main Lab 2B.
Make sure your code between the two partsmatches exactly except for the 9 changedconstants, otherwise you will lose points (as per the deductionslisted below). If you do find that you need to change anything elsefor your code to work properly, you should make that change in2B and here as well so that your codematches exactly except for those 9changed constants.
Implementation
You need a constant for ?. Use the exact const double PI =3.14159265 to make sure you match with our implementation. Use thefollowing values for the pizzas:
Pizza | Price | Diameter | People Fed |
Large | $14.68 | 20 inches | 7 people |
Medium | $11.48 | 16 inches | 3 people |
Small | $7.28 | 12 inches | 1 person |
Sample Input and Output
When you run the program in the case where there are 303 guestsand you want to give a 15% tip, the input will look like:
Sample Input
30315
Sample Output
In this case the output would look like:
Please enter how many guests to order for: 43 large pizzas, 0 medium pizzas, and 2 small pizzas will be needed.A total of 13735 square inches of pizza will be ordered (45.3302 per guest).Please enter the tip as a percentage (i.e. 10 means 10%): The total cost of the event will be: $743
Step 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