Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
oz
and
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
oz
Soda is $
and for a
Liter $
and an additional $
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:
x Custom Large Pizza $
x Hawaiian Pizza $
x
oz Coke $
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:
Pizza created by using the Builder class
different Pizzas created by calling two of the factory methods in your PizzaFactory class
Sodas created by calling the constructor method for the Soda class
Use the LineItemIterator to iterate over the Order you have created and print out each of the line items in the order.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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started