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

 PYT HON Create a class named PizzaOrder that stores information about

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

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!