Answered step by step
Verified Expert Solution
Question
1 Approved Answer
5 . 5 Lab 2 D - - Pizza For Everyone! This lab will be available until January 1 9 th , 1 0 :
Lab D Pizza For Everyone!
This lab will be available until January th: 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 hisher 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 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 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 slicesPerPizzadiameter 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:
Enter the number of people in your party:
For a party of people you need to order pizzas
A inch pizza will yield slices.
Welcome to Mario and Luigi's Pizzeria
Enter the diameter of the pizzas you want to order in inches:
Enter the number of people in your party:
For a party of people you need to order pizzas
A inch pizza will yield slices.
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