Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYT HON Create a class named PizzaOrder that stores information about a single pizza. It should contain the following: Constant value MAXTOPPINGS 15 - Private

image text in transcribed
PYT HON Create a class named PizzaOrder that stores information about a single pizza. It should contain the following: Constant value MAXTOPPINGS 15 - Private instance variables to store o size -the size of the pizza (either small, medium, or large) o num toppings- the number of toppings o toppings a list of strings ['cheese", 'onions", shrooms", "Grilled chicken", .A constructor that sets all of the instance variables. A method add_ topping0 that will take a string parameter, topping, and append0 it to the toppings list as long as the number it items in the list does not exceed the class's static MAX TOPPINGS A method named calc_cost() that returns a double that is the cost of the pizza. . Pizza cost is determined by: Small: $10 $2 per topping Medium: $12+$2 per topping Large: $14+ $2 per topping -str_-(self-a method that retums a String containing the pizza size and the pizza cost as calculated by calc_cost(). Write test code to create several pizzas and output their descriptions. For example, a large pizza with one cheese, one Grilled chicken, and two avocado toppings should cost a total of $22. Sample run: Size: Large, Cheese Toppings: 1 Grilled chicken Toppings: 0 onions Topp ings: 1. Cost: 18.0 Size: Medium, Cheese Toppings: 2 Grilled chicken Toppings: 2 onions To ppings: 0. Cost: 20.0 Size: Small, Cheese Toppings: 2 Grilled chicken Toppings: 1 onions Topp ings: 1. Cost: 18.0 Total of the order: 56.0

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

Semantics Of A Networked World Semantics For Grid Databases First International Ifip Conference Icsnw 2004 Paris France June 2004 Revised Selected Papers Lncs 3226

Authors: Mokrane Bouzeghoub ,Carole Goble ,Vipul Kashyap ,Stefano Spaccapietra

2004 Edition

3540236090, 978-3540236092

More Books

Students also viewed these Databases questions

Question

List two major forms of political risk.

Answered: 1 week ago

Question

Evaluate 3x - x for x = -2 Answer:

Answered: 1 week ago

Question

What is group replacement? Explain with an example. (2-3 lines)

Answered: 1 week ago