Question 1: Describe the “Employee” class and its usage in the “SingleEmployeeTest” class in a Java
program. The Employee class stores employee information like ID , work experience as years , salary,
and monthly scores, and provides methods for bonus eligibility, salary increment, and average score
calculation.
• The Employee class has the following attributes:
• int id to store the employee's ID.
• int workExperience to store the employee's work experience in years.
• double salary to store the employee's salary.
• int[] score to store an array of monthly scores.
• The Employee class also has the following methods:
• bonusEligibility(): Checks if the employee is eligible for a bonus based on work
experience and salary. If the employee work experience is more than 10 years or
monthly salary is less than 10000, employee would be eligible for bonus
• increment(int inc): Increments the employee's salary by a given percentage. The
increment would 20% of his/her monthly salary
• averageScore(): Calculates and prints the average score of the employee based on the
monthly scores.
Also provide an example of input and the expected output when using the SingleEmployeeTest” class
In the SingleEmployeeTest” class, user input is used to create 1 Employee object and perform
operations.
Example Input:
Enter ID: 1
Enter WorkExperience: 11
Enter Monthly Salary: 300
How many months you want to calculate score: 3
Enter 0 th month score: 1
Enter 1 th month score: 2
Enter 2 th month score: 3
Example Output:
Employee id= 1
workExperience in years= 11
monthly salary= 300.0
Eligible for bonus
incremented salary: 360.0
average score=2.0
Question 2: Now modify the “SingleEmployeeTest” class in a way so that now you can create “n”
number of employess and display their information.
Hint: use a loop to take information for multiple employees. You can achieve this by using an array to
store the employee objects and a loop to iterate over them