Answered step by step
Verified Expert Solution
Link Copied!

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
(
'
2
0
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
'
2
0
oz
'
Soda is $
1
.
5
0
and for a
'
2
Liter' $
2
.
5
0
and an additional $
0
.
5
0
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:
1
x Custom Large Pizza $
1
5
1
x Hawaiian Pizza $
1
4
2
x
2
0
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 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.
image text in transcribed

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

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions