You are on page 1of 1

Assessment-1

Part 1 : Write code and Test-cases

1) Create a class called Person (Base class) which includes below attributes:
id – integer
phone – String

address - String

gender – char (M/F)

2) Create a class called Employee (child Class of Person), which includes below attributes:
name - String

department (Has-a association)- Department

monthlySalary – double

3) Create a class called Department which includes below attributes:


deptCode – integer

deptName - String

4) Create a class called EmployeeFinancials to include below calculation,


o Add a method to generate the Updated annual salary after 5% of increment and
print it.
o Add another method to calculate tax, which is 10% for male employees and 5%
tax for female employees and print it.
5) Your class should have a reasonable number of constructors and accessor methods.

Write the following test cases:

1. Create Employee object, populate them and print using toString() method.

2. Calculate and print Employee details along with updated annual Salary

3. Calculate and print Employee details along with taxable income for each gender.

4. Create at least 5 employee objects with appropriate data

You might also like