Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
8 views1 page

Lab Task 5

The document outlines several programming tasks involving class hierarchies in Java, focusing on inheritance. It includes creating classes for plants, employees, vehicles, university staff, and bank accounts, each with specific attributes and methods. The tasks emphasize the implementation of properties and functionalities relevant to each class type.

Uploaded by

M. Tayyab Zia
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)
8 views1 page

Lab Task 5

The document outlines several programming tasks involving class hierarchies in Java, focusing on inheritance. It includes creating classes for plants, employees, vehicles, university staff, and bank accounts, each with specific attributes and methods. The tasks emphasize the implementation of properties and functionalities relevant to each class type.

Uploaded by

M. Tayyab Zia
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/ 1

Inheritance

1. Create a class Plants that has child classes of Trees and Shrubs. Create a Sub class of
Trees as Fruit bearing tress. Identify attributes and methods of each class. Instantiate
the fruit bearing tree class and show its attributes. Show the classes in the form of a
tree as well

2. Write a Java program that creates a class hierarchy for employees of a company. The
base class should be Employee, with subclasses Manager, Developer, and
Programmer. Each subclass should have properties such as name, address, salary, and
job title. Implement methods for calculating bonuses, generating performance reports,
and

3. Write a Java program to create a vehicle class hierarchy. The base class should be
Vehicle, with subclasses Truck, Car and Motorcycle. Each subclass should have
properties such as make, model, year, and fuel type. Implement methods for
calculating fuel efficiency, distance traveled, and maximum speed.

4. Write a Java program to create a class hierarchy for university staff.


The base class should be Staff, with subclasses Professor, Administrator, and
Technician. Each subclass should include properties like name, department, salary,
and position. Implement methods for assigning tasks, calculating overtime pay, and
generating weekly schedules.

5. Create a Java program that models a bank account system using inheritance.
Define a base class Account with subclasses SavingsAccount, CheckingAccount, and
FixedDepositAccount. Include properties such as account number, holder name, and
balance. Implement methods for deposit, withdrawal, interest calculation, and
displaying account summaries.

You might also like