Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
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:

  1. Private instance variables to store the size of the pizza (either small, medium,or large)
  2. the number of cheese toppings
  3. the number of pepperoni toppings
  4. the number of ham toppings.

  1. Constructor(s) that set all of the instance variables.
  2. Public methods to get and set the instance variables.
  3. A public method named calcCost( ) that returns a double that is the cost of the pizza.
  4. Pizza cost is determined by: Small: $10 + $2 per topping Medium: $12 + $2 per topping Large: $14 + $2 per topping
  5. public method named getDescription( ) that returns a String containing the pizzasize, quantity of each topping