Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Joe\'s Pizza Place needs a program to calculate the number of slices a pizza of

ID: 3623384 • Letter: J

Question

Joe's Pizza Place 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:

A) Ask the user for the diameter of the pizza in inches.

B) Calculate the number of slices that may be taken from a pizza of that size.

C) Display a message telling the number of slices.

To calculate the number of slices that may be taken from the pizza, you must know the following facts:

1. Each slice should have an area of 14.125 inches.
2. To calculate the number of slices, simply divide the area of the pizza by 14.125.
3. The area of the pizza is calculated with this formula: Area = pi r2.

3.14159 can be used for the value of pi. The variable r is the radius of the pizza. Divide the diameter by 2 to get the radius.

Make sure the output of the program displays the number of slices in fixed point notation, rounded to one decimal point of precision. Use a named constant for pi.

Explanation / Answer

#include using namespace std; #include int main() { const float PI = 3.14159; const float SLICE_SIZE = 14.125; float rad, totalArea, dia, slices; cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote