title | course |
---|---|
練習11 Q11.py |
S2 - Intermediate Python Programming |
Create a class named Pizza that stores information about a single pizza. It should contain the following:
- Private instance variables to store the size of the pizza (either small, medium,or large)
- the number of cheese toppings
- the number of pepperoni toppings
- the number of ham toppings.
- Constructor(s) that set all of the instance variables.
- Public methods to get and set the instance variables.
- A public method named calcCost( ) 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
- public method named getDescription( ) that returns a String containing the pizzasize, quantity of each topping