IT 117: Intermediate to Scripting
Answers to Class 19 Ungraded Quiz

  1. Using data hiding, write the constructor for the Car class with the attributes
    manufacturer
    model
    year
    color
    def __init__(self, manufacturer, model, year, color):	          self.__manufacturer = manufacturer
              self.__model       = model
              self.__year        = year
    		  self.__color	   = color
  2. Write accessor methods for each of the attributes of the Car class.
        def get_manufacturer(self):	          return self.__manufacturer
    
         def get_model(self):
              return self.__model
    
         def get_year(self):
              return self.__year
    
         def get_color(self):
    		  return self.__color 
  3. Write the __str__ method for the Car class.
    def __str__(self):			  return self.__manufacturer +  " " +self.__model + " " + self.__year + " " + self.__color