Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python 3: Create a class called Vehicle. This class should have instance variables for mode (land, air, water), maxPassengers (maximum number of passengers), and odometer

python 3:

Create a class called Vehicle. This class should have instance variables for mode (land, air, water), maxPassengers (maximum number of passengers), and odometer (number of miles on the vehicle).

This class should overload the string and equality operators so that the user can use print() and == with two objects of the class. Your class should have a constructor that allows the user to instantiate an object and pass it all relevant information.

You should also have a method called odometerAdd() that will add a quantity to the odometer.

Should Output:

The mode of transport is: air

Can carry up to: 6

Odometer: 2500

NEXT, create 2 subclasses of "Vehicle": Car, and Boat. These subclasses should inherit the attributes and methods of its parent class.

The Car class should include the additional attributes: make, model, color.

The Boat class should include attributes: length, and horsepower.

The two subclasses should also override the equality and string operators as you did in the parent (Vehicle) class.

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

What is group replacement? Explain with an example. (2-3 lines)

Answered: 1 week ago

Question

4. Identify cultural variations in communication style.

Answered: 1 week ago