Question: 5 . 5 Lab 2 D - - Pizza For Everyone! This lab will be available until January 1 9 th , 1 0 :

5.5 Lab 2D -- Pizza For Everyone!
This lab will be available until January 19th,10:50 AM EST
Mario and Luigi's Pizzeria needs a program to calculate:
the number of slices a pizza of any size can be divided into, and
the number of pizzas a customer should order so there is enough pizza for his/her party.
Write a program that:
Asks the user to enter the diameter of the pizzas to be ordered (in inches)
Asks the user to enter the number of people in the customer's party.
Calculates the number of slices that may be taken from a pizza of the given size.
Calculates the number of pizzas that need to be ordered, assuming that each person in the customer's party will eat an average of 3 slices.
Display the results, that is, the number of slices each pizza yields and how many pizzas should be ordered.
To calculate the number of slices that may be taken from a pizza, you must know the following facts:
Each slice should have an area of 14.125 inches
The area of the pizza is calculated with the same formula you use to calculate the area of a circle
You must determine the number of slices using a function slicesPerPizza(diameter). Given the diameter of the pizza, it will return the number of slices the pizza will have as an integer.
Note: You will need to round the results. In order to do that, you must import the math module (hint: you will need to use ceil() and floor()).
Here are a few sample runs:
Welcome to Mario and Luigi's Pizzeria
Enter the diameter of the pizzas you want to order (in inches): 14
Enter the number of people in your party: 3
For a party of 3 people you need to order 1 pizza(s).
A 14 inch pizza will yield 10 slices.
Welcome to Mario and Luigi's Pizzeria
Enter the diameter of the pizzas you want to order (in inches): 16
Enter the number of people in your party: 20
For a party of 20 people you need to order 5 pizza(s).
A 16 inch pizza will yield 14 slices.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!