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

More Books

Students also viewed these Databases questions

Question

Define induction and what are its objectives ?

Answered: 1 week ago

Question

Discuss the techniques of job analysis.

Answered: 1 week ago

Question

How do we do subnetting in IPv6?Explain with a suitable example.

Answered: 1 week ago

Question

Explain the guideline for job description.

Answered: 1 week ago

Question

What is job description ? State the uses of job description.

Answered: 1 week ago

Question

Appreciate the legal implications of employment documentation

Answered: 1 week ago