Pizza Pi
Joe’s Pizza Palace needs an application to calculate the number of slices a pizza of any size can be divided into. The application should do the following:
a. Allow the user to enter the diameter of the pizza, in inches.
b. Calculate the number of slices that can be cut from a pizza that size.
c. 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 facts:
a. Each slice should have an area of 14.125 inches.
b. To calculate the number of slices, divide the area of the pizza by 14.125.
The area of the pizza is calculated with the following formula:
Area - πr2
NOTE: π is the Greek letter pi. 3.14159 can be used as its value. The variable r is the radius of the pizza. Divide the diameter by 2 to get the radius.
Use the following test data to determine if the application is calculating properly:
Diameter of Pizza | Number of Slices |
22 inches | 27 |
15 inches | 13 |
12 inches | 8 |
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.