0% found this document useful (0 votes)
3 views3 pages

Inheritance Overriding

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)
3 views3 pages

Inheritance Overriding

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/ 3

A.

Write a Java Program that includes the following details


You are tasked to create a program to implement a simple Employee Management System
that will provide information about Employees such as their salary and Employment
status.
1. Create an Employee class and do the following:
a) Declare the following member variables: Employee Id, Employee Name, and Salary
b) Create a default constructor with no parameter.
c) Create a parameterized constructor to initialize all the member variables.
d) Create a method to display all the member variables.
e) Create a method that will compute the Total Salary of the Employee and return it.
The method will accept one parameter Bonus of type double.
The Total Salary is computed as Salary + Bonus.
f) Generate the getters and setters.
2. Create a class Admin and do the following:

a) The class should inherit the Employee Class.

b) Declare a member variable Basic Salary and Allowance

c) Create a default constructor with no parameter

d) Create a parameterized constructor that will call the constructor of the parent class

(super class) and then initialize the member variables.

e) Create a method that will return a value to calculate the total Salary by the Employee

using the formula below:

Total Salary = Basic Salary + Allowance

f) Create an overriding method to display all the member variables. The method should

invoke/call the super class display method and then display also all the member

variables of this class.


3. Create a class Teaching and do the following:

a) The class should inherit the Employee Class.

b) Declare a member variable Total number of teaching hours and Advising hours

c) Create a default constructor with no parameter

d) Create a parameterized constructor that will call the constructor of the parent class

(super class) and then initialize the member variables.

e) Create a method that will return a value to determine the status of the Employee based

on the criteria below:

When Total number of teaching hours is greater than or equal to 18 AND

Advising hours is greater than or equal to 2 then the status of the Employee is

“Full Load”.

Otherwise the status of the Employee is “Not Full Load”

The method should return the status of the Employee.

f) Create an overriding method to display all the member variables. The method should

invoke/call the super class display method and then display also all the member

variables of this class.


Create a controlling class and do the following:
 Create an object for the two (2) subclasses

 Read the input, call the necessary methods, and display the required output as shown

below

 Sample Input / utput:

You might also like