Question

Your task in this programming assignment is to write a Python program that implements a simple vehicle class. The class model
# Description: 非 c# L件非 11群群洋 p并带 t##群 Il### o### # 并“并 ## ## 十一 中山市 十 上。 中共 十一 年十一 非非 一對一 十 ## #### ##### 。 非非 作用。 十一时 十片 ##

it needs to match the sample and the code given can't be modify or removed and has to be on python 2
0 0
Add a comment Improve this question Transcribed image text
Answer #1

class Vehicle(object):
    def __init__(self, make, model):
       self.__make = make
       self.__model = model
       self.__year = 2000

    @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

    @property
    def year(self):
        return self.__year


    @year.setter
    def year(self,value):
        if value >= 2000 and value <=2018:
           self.__year = value

  


v1 = Vehicle("Dodge", "Ram")
v2 = Vehicle("Honda", "Odyssey")
print "v1={} {}".format(v1.make, v1.model)
print "v2={0} {1}".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)
print

х in (3) Technical Releasel + X E = Computer Scieno X G zero length field nam python - Whats the 21.15. propertyo: CreValueE

Add a comment
Know the answer?
Add Answer to:
it needs to match the sample and the code given can't be modify or removed and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Each question needs a screenshot of the result and the code. insert appropriate amount of comments...

    Each question needs a screenshot of the result and the code. insert appropriate amount of comments in the code. Exercise-1: Plant class. Define a class Plant that satisfies the spec below. Hints A. For this problem, provide an implementation for the Plant spec below, and test it using the example calls provided B. Although the constructor is described in the spec (and called) using the name Plant), the internal name for a class's constructor is_init__(). (There are two underscores before...

  • We are to make a program about a car dealership using arrays. I got the code...

    We are to make a program about a car dealership using arrays. I got the code to display all cars in a list, so I'm good with that. What I'm stuck at is how to make it so when a user inputs s for search, it allows them to search the vehicle. Here is what I have so far     public class Car {         String color;         String model;         String year;         String company;         String plate;       ...

  • HELLO, PLEASE TAKE TIME TO ANSWER THIS QUESTION. PLESE ENSURE ITS CORRECT AND SHOW THAT THE...

    HELLO, PLEASE TAKE TIME TO ANSWER THIS QUESTION. PLESE ENSURE ITS CORRECT AND SHOW THAT THE PROGRAM RUNS. Task 1: Enforcing const-ness throughout Your first job will be to go through all of the code and decide which functions should be declared const. You should find several places throughout the program where this makes sense. We will also make the id data member in the Customer class const , as once a customer has been created their ID will never...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT