#include<iostream> #include<cmath> using namespace std; int main() { const double areaOfSlice = 14.125;//In inches^2 const double PI = 3.14159; double diameter, radius, areaOfPizza; int numberOfPeople; cout << "Enter diameter of pizzas: "; cin >> diameter; cout << "Enter number of people who will be at the party: "; cin >> numberOfPeople; radius = diameter/2;//Radius of pizza areaOfPizza = PI*radius*radius;//Area of a piece int numberOfSlicesPerPizza = areaOfPizza/areaOfSlice;//Calculate number of slices in a single pizza int numberOfPizzas = ceil(numberOfPeople * 3.0 / numberOfSlicesPerPizza);//Calculate number of pizzas needed cout << "Number of slices per pizza: " << numberOfSlicesPerPizza << endl; cout << "Number of pizzas needed for the party: " << numberOfPizzas << endl; return 0; }
SAMPLE OUTPUT:
Pseudocode:
START input diameterOfPizza input numberOfPeople radius = diameterOfPizza areaOfPizza = 3.14159*radius*radius numberOfSlicesPerPizza = areaOfPizza/14.125 numberOfPizzas = ceil(numberOfPeople*3/numberOfSlicesPerPizza) output numberOfSlicesPerPizza output numberOfPizzas END
A restaurant called Tony’s Pizza Palace needs a program to help calculate rhe number of slices...
Murphy Pizza Palace needs an application to calculate the number of slices of a pizzaof any size can be divided into. The application should do the following: Allow the user to enter the diameter of the pizza, in inches. Calculate the number of slices that can be cut from a pizza that size. Display a message that indicates the number of slices. To calculate the number of slices that can be cut from the pizza, you must know the following...
(The file should have your program and the console input/output of your program) 3.18: Pizza Pi Joe’s Pizza Palace needs a program to calculate the number of slices a pizza of any size can be divided into. The program should perform the following steps: Ask the user for the diameter of the pizza in inches. Calculate the number of slices that may be taken from a pizza of that size. Display a message telling the number of slices. To calculate...