Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your task in this programming assignment is to write a Python program that implements a simple vehicle class. The class models a vehicle that has

image text in transcribed

Your task in this programming assignment is to write a Python program that implements a simple vehicle class. The class models a vehicle that has a year, a make, and a model (e g, 2016 Dodge Ram, 2007 Honda Civic, etc). For a 2016 Dodge Ram, for example, the year is 2016, the make is Dodge, and the model is Ram You will be provided a template that includes code (that you cannot change) in the main part of the program to test the vehicle class: # DO NOT MODIFY OR REMOVE ANYTHING BELOW THIS POINT! # the main part of the program vl vehicle ("Dodge", "Ram") v2 = Vehicle ("Honda", "Odyssey") print "v1={} {}".format (v1.make, vl.model) print "v2- .format (v2.make, v2.model) print vl.year2016 v2.year2016 print "v1= { } { } print "v2={} {} { } " . format (v1 . year, {}". format (v2-Year, vi . make, v2.make, vi . model) v2.model) print v2.year1999 v2.mode! = "Civic" v2.year = 2007 print "v1= { } { } { } " . format (v1 . year, print "v2={} {} {}".format (v2.year, v1 . make, v2.make, vi . model) v2.model) This sample code should provide some details of how to structure your vehicle class. output of this code with a correctly implemented vehicle class looks like: Here's what the vl-Dodge Ram v2-Honda Odyssey v1-2016 Dodge Ram v2-2016 Honda Odyssey v1=2016 Dodge Ram v2-2007 Honda Civic To help clarify, here are some constraints (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 vaiable (ie, year, make, and model) nmust 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 (5) You must include a meaningful header, use good coding style, use meaningful variable names and comment your source code where appropriate; (6) Your output should be exactly like the sample run shown above; and (7) You must submit your source code as a single py file. Please use the template below to fomat your program: # Name: # Date: # Description: # the vehicle cla33 # a vehicle has a year, make, and model # DO NOT MODIEY OR REMOVE ANYTHING BELOW THIS POINT! # the main part of the program vlVehicle ("Dodge""Ram" v2 = Vehicle ("Honda", "Odyssey") print "1-0 [)" .format (vl.make, v1.model) print "v2- .format (v2.make, v2.model) print v1 . year = 2016 v2.year2016 print "v1= { } { } { } " format (vi . year, v1 .make, vi .model) print "v2- .format (v2.year, v2.make, v2.model) print v2.year = 1999 vi.mOacl"CivIC" v2. year = 2007 print "1- ".format (v1.year, v1.make, vi.model) print "v2= { } { } { } " format (v2. year, v2 .make, v2 .model)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is a status bar? When might a status bar be inappropriate?

Answered: 1 week ago