IT 117: Intermediate Scripting
Answers to Class 18 Ungraded Quiz

  1. Write a constructor method for the class Car that sets the following 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 the method get_manufacturer that returns the manufacturer.
    def get_manufacturer(self):
              return self.manufacturer
  3. Write the method get_model that returns the model.
    def get_model(self):
              return self.model
  4. Write the method get_year that returns the year.
    def get_year(self):
              return self.year
  5. Write the method get_color that returns the color.
    def get_color(self):
              return self.color
  6. Write the method get_model_year that returns the model and the year separated by a space.
    def get_model_year(self):
              return self.model + " " + self.year