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 07(CLO1-PLO4) , (CLO2-PLO5),(CLO3-PLO5)

1. Write a Java program to create an abstract class Vehicle with abstract methods startEngine() and
stopEngine(). Create subclasses Car and Motorcycle that extend the Vehicle class and implement
the respective methods to start and stop the engines for each vehicle type.

2. An abstract class has a construtor which prints "This is constructor of abstract class", an abstract
method named 'a_method' and a non-abstract method which prints "This is a normal method of
abstract class". A class 'SubClass' inherits the abstract class and has a method named 'a_method'
which prints "This is abstract method". Now create an object of 'SubClass' and call the abstract
method and the non-abstract method. (Analyse the result)

3. Write a Java program to create a class called Employee with private instance variables
employee_id, employee_name, and employee_salary. Provide public getter and setter methods to
access and modify the id and name variables, but provide a getter method for the salary variable
that returns a formatted string.

You might also like