Implement the following concepts by constructing suitable classes in Java - a. Constructors b. Constructor Overloading c. Function Overloading d. Function Overriding e. Inheritance Create a class Person - Field - Name, Birthdate, Contact no and Mail id Methods - Constructor, accept and display Class Employee - Inherits the Person class Fields : Emp ID, grade, basic salary, Gross Salary, HRA (House Rent Allowance), TA (Traveling Allowance), DA (Dearness Allowance) Given: Grade Basic TA A 8000 2000 B 7000 1500 C 6000 1000 D 5000 500 Calculate Gross Salary : Gross Salary = Basic + HRA (20% of Basic) + DA (50% Basic) + TA e.g if Basic = 8000 TA = 2000 HRA = 20% of 8000 = 1600 DA = 50 % of 8000 = 4000 Gross = 8000 + 2000 + 1600 + 4000 = 15600 Optional : you can implement increment function in which you can change grade of an employee and recalculate salary with new grade
Implement the following concepts by constructing suitable classes in Java -
a. Constructors
b. Constructor Overloading
c. Function Overloading
d. Function Overriding
e. Inheritance
Create a class Person - Field - Name, Birthdate, Contact no and Mail id
Methods - Constructor, accept and display
Class Employee - Inherits the Person class
Fields : Emp ID, grade, basic salary, Gross Salary, HRA (House Rent Allowance), TA (Traveling
Allowance), DA (Dearness Allowance)
Given:
Grade Basic TA
A 8000 2000
B 7000 1500
C 6000 1000
D 5000 500
Calculate Gross Salary :
Gross Salary = Basic + HRA (20% of Basic) + DA (50% Basic) + TA
e.g if Basic = 8000
TA = 2000
HRA = 20% of 8000 = 1600
DA = 50 % of 8000 = 4000
Gross = 8000 + 2000 + 1600 + 4000 = 15600
Optional : you can implement increment function in which you can change grade of an employee and
recalculate salary with new grade
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images