class Vehicle:
    def __init__(self, make, model):
        self.year = 2000
        self.make = make
        self.model = model
    @property
    def year(self):
        return self._year
    @year.setter
    def year(self, value):
        if (value > 2000 and value < 2018):
            self._year = value
    @property
    def make(self):
        return self._make
    @make.setter
    def make(self, value):
        self._make = value
    @property
    def model(self):
        return self._model
    @model.setter
    def model(self, value):
        self._model = value
# ***DO NOT MODIFY OR REMOVE ANYTHING BELOW THIS POINT!***
# the main part of the program
v1 = Vehicle("Dodge", "Ram")
v2 = Vehicle("Honda", "Odyssey")
print "v1={} {}".format(v1.make, v1.model)
print "v2={} {}".format(v2.make, v2.model)
print
v1.year = 2016
v2.year = 2016
print "v1={} {} {}".format(v1.year, v1.make, v1.model)
print "v2={} {} {}".format(v2.year, v2.make, v2.model)
print
v1.year = 1999
v2.model = "Civic"
v2.year = 2007
print "v1={} {} {}".format(v1.year, v1.make, v1.model)
print "v2={} {} {}".format(v2.year, v2.make, v2.model)
I need help implementing a mutator and accessor for the year variable. The instructions are as follows:
(1)The constructor must take two parameters, make and model, and make proper use of mutators to set these values; (2) By default, a newly instantiated vehicle has a year of 2000; (3) Accessors and mutators (using the decorator method discussed in class) for each instance variable (i.e., year, make, and model) must be included; (4) A vehicle must have a year that is between 2000 and 2018 inclusive (i.e., implement range checking so that any other provided value is ignored)
The correct output should be:
v1=Dodge Ram v2=Honda Odyssey
v1=2016 Dodge Ram v2=2016 Honda Odyssey
v1=2016 Dodge Ram v2=2007 Honda Civic
My output however:
v1=Dodge Ram v2=Honda Odyssey
v1=2016 Dodge Ram v2=2016 Honda Odyssey
v1=1999 Dodge Ram v2=2007 Honda Civic
The accessor and mutator for year is not correctly checking for the range in which the value is acceptable. I'm still quite new to programming so I apologize if this is a simple question/simple fix!!
 
    