Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program: A Simple Vehicle Class Your task in this programming assignment is to write a Python program that implements a simple vehicle class. The class

image text in transcribed
image text in transcribed
Program: A Simple Vehicle Class 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 vi - Vehicle ("Dodge", "Ram") v2 = Vehicle ("Honda", "Odyssey") print("vi-(0". format (v1.make, vi.model)) print("v2-0) 0".Format (v2.make, v2.model)) print() v1.year - 2016 v2.year = 2016 print("vi-0) 0 0". format (v1.year, vi.make, vi.model)) print("v2-0) 0 ()". format (v2.year, v2.make, v2.model) print() vi.year - 1999 v2.model "Civic" v2.year 2007 print("vl=0) OO". format (v1.year, vi.make, vl.model)) print("v2=0) 0 0".Format (v2.year, v2.make, v2.model)) This sample code should provide some details of how to structure your vehicle class. Here's what the output of this code with a correctly implemented vehicle class looks like: vi-Dodge Ram V2-Honda Odyssey v1-2016 Dodge Ram v2=2016 Honda Odyssey vi-2016 Dodge Ram V2-2007 Honda Civic To help clarify, here are some specifics and/or 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 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); (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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions