Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

National University of Modern Languages (NUML)

BS(CS) 2nd Semester CSO0 142: OOP

This lab plan is intended to be completed individually, so it is important to exercise caution and refrain
from plagiarizing the work of others. If any instances of copying are identified, both parties involved
will receive a score of zero. Additionally, it is advisable to take measures to safeguard your assignment
from unauthorized access by others. There will be no exceptions or excuses accepted for cases of
plagiarism or facilitating plagiarism.

LAB Plan 04 (CLO1-PLO4) , (CLO2-PLO5),(CLO3-PLO5)

Question #01:
Write a Java program to create a class called Vehicle with a method called drive(). Create a
subclass called Car that overrides the drive() method to print "Repairing a car".

Question#02:
Design a class hierarchy to model different types of vehicles. Start with a base class Vehicle and
create child classes Car and Motorcycle inheriting from it. Further, create child classes
ElectricCar and GasolineCar inheriting from Car, and SportsBike and TouringBike inheriting
from Motorcycle. Implement methods specific to each class, such as start_engine() for cars and
start_engine() for motorcycles. Ensure that common functionality is appropriately inherited
across the hierarchy.

You might also like