Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions

Question

Solve for x. log x log(x+8)=-1

Answered: 1 week ago

Question

How would you train others to perform the task? Explain.

Answered: 1 week ago

Question

Why is it important for a firm to conduct career development?

Answered: 1 week ago