Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function orderPizza that allows the user input to build a pizza. It then prints a thank you message, the cost of the pizza

  1. Write a function orderPizza that allows the user input to build a pizza.  It then prints a thank you message, the cost of the pizza and then returns the Pizza that was built.

>>> orderPizza()

Welcome to Python Pizza!

What size pizza would you like (S,M,L): M

Type topping to add (or Enter to quit): mushroom

Type topping to add (or Enter to quit): onion

Type topping to add (or Enter to quit): garlic

Type topping to add (or Enter to quit): 

Thanks for ordering!

Your pizza costs $14.299999999999999

Pizza('M',{'mushroom', 'onion', 'garlic'})

>>> orderPizza()

Welcome to Python Pizza!

What size pizza would you like (S,M,L): L

Type topping to add (or Enter to quit): calamari

Type topping to add (or Enter to quit): garlic

Type topping to add (or Enter to quit): 

Thanks for ordering!

Your pizza costs $16.65

Pizza('L',{'garlic', 'calamari'})

>>> p=orderPizza()

Welcome to Python Pizza!

What size pizza would you like (S,M,L): S

Type topping to add (or Enter to quit): 

Thanks for ordering!

Your pizza costs $6.25

>>> p

Pizza('S',set())

>>>


Step by Step Solution

3.50 Rating (150 Votes )

There are 3 Steps involved in it

Step: 1

Code output Code to copy class Pizza default constructor that ta... 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

Java Programming

Authors: Joyce Farrell

9th edition

1337397075, 978-1337397070

More Books

Students also viewed these Programming questions

Question

14. What are the functions of the prefrontal cortexpg109

Answered: 1 week ago