Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please give me the py file thanks! 1. (Composition) Write a Pizza class so that this client code works. Please note that it is ok

image text in transcribedPlease give me the py file thanks!

1. (Composition) Write a Pizza class so that this client code works. Please note that it is ok if the toppings are listed in a different order Pizza ( ) >>> ple >>> pie.getsize pepperoni') anchovies') mushrooms >>> pie Rizza('L,anchovies', 'mushrooms, 'pepperoni') pepperoni') >>pie Rizzal'L,'anchovies', "mushrooms','pepperoni') >>> pie removetoppina.' anchovies') >>> p1e Pizza('L,'mushrooms,'pepperoni') 16.65 >>> pie2 = PkzZal'L', {'mushrooms pepperoni., ) >>> pie2 Pizza('L,'mushrooms,'pepperoni') >>>pie pie2 True The Pizza class should have two attributes(data items) size _ a single character st, one of" S',' M'.." toppings-a set containing the toppings. If you don't remember how to use a set, make sure you look it up in the book. Please note that toppings may be listed in a different orde but hw2TEST.py takes that into account The Pizza class should have the following methods/operators): init -constructs a Pizza of a given size (defaults to 'M") and with a given set of toppings (defaults to empty set). I highly recommend you look at the Queue class in the book to see how to get this to work correctly set Size-set pizza size to one of 'S, Mor getsize-retums size addIopping-adds a topping to the pizza, no duplicates, i.e., adding pepperoni' twice only addsit once zenoveTopping-removes a topping from the pizza price-retums the price of the pizza according to the following scheme 'S': S6.25 plus 70 cents per topping M': S9.95 plus S1.45 per topping L': S12.95 plus S1.85 per topping repr-retums representation as a string - see output sample above. Note that toppings may be listed in a different order egtwo pizzas are equal if they have the same size and same toppings (toppings don't need to be in the same order)

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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions