Question: code them all. Assignment Instructions For this assignment, you will be creating classes based on the UML diagram below. One class, the Pizza class, has

code them all. Assignment Instructions
For this assignment, you will be creating classes based on the UML diagram below. One class, the Pizza class, has code included in the instructions that you can use.Additional Information:
To be able to use the Purchasable class (and its subclasses) as a key in a dictionary it will be necessary to override the __eq__ and __hash__ methods within that class. The __eq__ method can consider two Purchasables equivalent if they have the same name and the same cost. The __hash__ method can return a hash (use Python's hash function) of a tuple containing the name and cost of the purchasable.
You should create all of the other classes described in the UML Diagram. Sodas can have two sizes ('20 oz' and '2 Liter') and can be one of these flavors: 'Coke', 'Sprite', 'Mt. Dew', 'Root Beer', 'Orange', 'Grape'. For calculating the cost of a soda, the base cost for a '20 oz' Soda is $1.50 and for a '2 Liter' $2.50 and an additional $0.50 if it's a premium Soda which is one of 'Coke', 'Sprite', or 'Mt. Dew'.
For the PizzaFactory class you can broadly decide the exact toppings for the different pizzas. Each factory method should assign a name to the constructed Pizza object so that it doesn't have the "Custom Size Pizza" name assigned to it.
The LineItemIterator class for the Order class should iterate over lines in an order and produce output that looks similar to the following:
1x Custom Large Pizza $15
1x Hawaiian Pizza $14
2x 20 oz Coke $4
Testing Your Assignment:
Include some test code as part of your assignment where you create an order Object and add the following to the order:
1 Pizza created by using the Builder class
2 different Pizzas created by calling two of the factory methods in your PizzaFactory class
2 Sodas created by calling the constructor method for the Soda classAssignment Instructions
For this assignment, you will be creating classes based on the UML diagram below. One class, the Pizza class, has code included in the instructions that you can use.
 code them all. Assignment Instructions For this assignment, you will be

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!