Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise-3: 10 points MyCar class Represents selected information about a car. Class variables Attributes of a car Instance variables Car owner name, Make, Model Constructor

Exercise-3: 10 points

MyCar class

Represents selected information about a car.

Class variables

Attributes of a car

Instance variables

Car owner name, Make, Model

Constructor

MyCar

arguments:

car_owner_name, make, model

State change:

A new object of type Car is created. Values for the cars owner, make and model are assigned. (Instance variables)

Return:

That newly created Car object.

Methods

setInformation

arguments:

attributes - year, body_style, color, vin_number, cylinders, etc

State change: (changes class variables)

The classs variables are changed

Return:

New values of classs variables

(Clue: how can we use the class variables in setInformation? Declare those as global.)

DescribeCar

No arguments.

Return:

All information about the car including class and instance variables

Example calls:

 
Altima=Car("vinay","nissan","altima") Altima.setInformation("2007","red","dsd2324424244") print (Altima.DescribeCar())

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

Students also viewed these Databases questions

Question

3. What is the matching principle?

Answered: 1 week ago

Question

ethical and moral values in reciprocal relationships;

Answered: 1 week ago

Question

2. To compare the costs of alternative training programs.

Answered: 1 week ago