0% found this document useful (0 votes)
3 views

Assignment 8

The document outlines an assignment involving object-oriented programming concepts such as abstraction and polymorphism. It requires the creation of a base class 'Vehicle' with various attributes and methods, along with two derived classes 'Truck' and 'Bus' that inherit from 'Vehicle' and implement their own specific attributes and overridden display methods. Each class must include parameterized constructors, getters, and setters for their respective attributes.

Uploaded by

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

Assignment 8

The document outlines an assignment involving object-oriented programming concepts such as abstraction and polymorphism. It requires the creation of a base class 'Vehicle' with various attributes and methods, along with two derived classes 'Truck' and 'Bus' that inherit from 'Vehicle' and implement their own specific attributes and overridden display methods. Each class must include parameterized constructors, getters, and setters for their respective attributes.

Uploaded by

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

Assignment 8

Task 1 (Abstraction):
Task 2(Polymorphism):

A – Create class Vehicle which contains:


• Vehicle model string
• Registration number string
• Vehicle speed (km/hour) integer
• Fuel capacity (liters) double
• Fuel consumption (liter/km) double
• Parameterized constructor

• A virtual method display()


method that will display all the information of a vehicle.

B - Create Class Truck which will inherit from Vehicle:


• Data Member: Cargo weight limit (Kilo grams).
• Parameterized constructor.
• Setter and getter.
• A display() method which will override parent method and print all info.

C - Create Class Bus which will inherit from Vehicle:


• Data member: Num of passengers int.
• Parameterized constructor.
• Setter and getter.
• A display() method which will override parent method and print all info.

You might also like