0% found this document useful (0 votes)
356 views2 pages

Create A Class Called Vehicle

The document describes creating a Vehicle class with attributes for make, year, and horsepower. It then describes creating subclasses Bus and Truck that inherit from Vehicle, with Bus having a numOfPassengers attribute and Truck having a towingCapacity attribute. Both subclasses contain display methods to show their own attributes as well as those inherited from Vehicle.

Uploaded by

Catherine Balite
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
356 views2 pages

Create A Class Called Vehicle

The document describes creating a Vehicle class with attributes for make, year, and horsepower. It then describes creating subclasses Bus and Truck that inherit from Vehicle, with Bus having a numOfPassengers attribute and Truck having a towingCapacity attribute. Both subclasses contain display methods to show their own attributes as well as those inherited from Vehicle.

Uploaded by

Catherine Balite
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Create a class called Vehicle.

Java with instance variables make (such as Ford, GM, Toyota, or Honda),
year, and horsepower(such as 200, 300, and 400). Add the necessary constructor and set and get
methods. Then create classes Bus and Truck respectively. Bus has an instance variable called
numOfPassengers (such as 1 or 50) and Truck has an instance variable called towingCapacity (such as
0.5, 1.0, 2.0, or 3.0 tons). Both Bus and Truck inherit from Vehicle and contain their own display methods
for displaying all their attributes (including the inherited ones).

Create a class called Vehicle.Java with instance variables make (such as Ford, GM, Toyota, or Honda),
year, and horsepower(such as 200, 300, and 400). Add the necessary constructor and set and get
methods. Then create classes Bus and Truck respectively. Bus has an instance variable called
numOfPassengers (such as 1 or 50) and Truck has an instance variable called towingCapacity (such as
0.5, 1.0, 2.0, or 3.0 tons). Both Bus and Truck inherit from Vehicle and contain their own display methods
for displaying all their attributes (including the inherited ones).

Create a class called Vehicle.Java with instance variables make (such as Ford, GM, Toyota, or Honda),
year, and horsepower(such as 200, 300, and 400). Add the necessary constructor and set and get
methods. Then create classes Bus and Truck respectively. Bus has an instance variable called
numOfPassengers (such as 1 or 50) and Truck has an instance variable called towingCapacity (such as
0.5, 1.0, 2.0, or 3.0 tons). Both Bus and Truck inherit from Vehicle and contain their own display methods
for displaying all their attributes (including the inherited ones).

Create a class called Vehicle.Java with instance variables make (such as Ford, GM, Toyota, or Honda),
year, and horsepower(such as 200, 300, and 400). Add the necessary constructor and set and get
methods. Then create classes Bus and Truck respectively. Bus has an instance variable called
numOfPassengers (such as 1 or 50) and Truck has an instance variable called towingCapacity (such as
0.5, 1.0, 2.0, or 3.0 tons). Both Bus and Truck inherit from Vehicle and contain their own display methods
for displaying all their attributes (including the inherited ones).

Create a class called Vehicle.Java with instance variables make (such as Ford, GM, Toyota, or Honda),
year, and horsepower(such as 200, 300, and 400). Add the necessary constructor and set and get
methods. Then create classes Bus and Truck respectively. Bus has an instance variable called
numOfPassengers (such as 1 or 50) and Truck has an instance variable called towingCapacity (such as
0.5, 1.0, 2.0, or 3.0 tons). Both Bus and Truck inherit from Vehicle and contain their own display methods
for displaying all their attributes (including the inherited ones).

Create a class called Vehicle.Java with instance variables make (such as Ford, GM, Toyota, or Honda),
year, and horsepower(such as 200, 300, and 400). Add the necessary constructor and set and get
methods. Then create classes Bus and Truck respectively. Bus has an instance variable called
numOfPassengers (such as 1 or 50) and Truck has an instance variable called towingCapacity (such as
0.5, 1.0, 2.0, or 3.0 tons). Both Bus and Truck inherit from Vehicle and contain their own display methods
for displaying all their attributes (including the inherited ones).

You might also like