In this post, we will learn Employee rating Program in java Programming language.
Question:
DreamTek Company provides a rating to its employees based on the “Certification” they have completed. For each certification completed by the employee the rating will be increased by one. Based on the rating the company planned to provide an increment for the employees. For the current year , the employees can take up any of the certification courses. They are:
a. JAVA
b. ORACLE
c. GCUX
d. CCNA
e. AWS
For each certification the rating will be 1. If an employee has completed three certifications, their rating will be 3. The employee is supposed to take up the certification suggested by the company. If the employee takes up some other certification, their rating will not be updated for that certification.
The increment for the employee will be given based on the below criteria:
Rating | Increment Percentage |
1 | 2% |
2 | 3.5% |
3 | 5% |
4 | 7.5% |
5 | 10% |
employee
Help the DreamTek Company to develop a java application to do the above task.
Consider the below class:

In the Employee class include the given attributes methods and constructor with the access specifiers as specified in the class diagram.
The constructors are used to initialize the value and the getter methods are used to retrieve the value.
The findRating() method should set the rating based on the certification completed by the employee.
The calculateIncrement() method should calculate the increment based on the rating and update the salary with the incremented amount. This method should return the increment amount. (For example: if the salary is 50000, and the incremented amount is 4000, then this method should return 4000, and update the salary as 54000).
In the Main class, Get the details as shown in the sample input and create an object for the Employee class; invoke the appropriate methods to get the results as shown in the sample output.
Sample Input1:
Enter the employee id:
TEK163
Enter the salary:
50000
Enter the no of certification complete:
3
Enter the certification names:
JAVA
ORACLE
CCNA
Sample Output1:
Your rating is 3
Increment amount is 2500.00
Current salary 52500.00
Sample Input2:
Enter the employee id:
TEK163
Enter the salary:
50000
Enter the no of certification complete:
3
Enter the certification names:
JAVA
J2EE
CCNA
Sample Output2:
Your rating is 2
Increment amount is 1750.00
Current salary 51750.00
Sample Input3:
Enter the employee id:
TEK163
Enter the salary:
50000
Enter the no of certification complete:
3
Enter the certification names:
PHP
J2EE
MYSQL
Sample Output3:
Your rating is 0
Increment amount is 0.00
Current salary 50000.00
CODE:–
import java.util.Scanner; public class Main{ public static void main (String[] args) { Scanner sc = new Scanner(System.in); String[] certification; System.out.println("Enter the employee id:"); String eid = sc.next(); System.out.println("Enter the salary:"); double sal = sc.nextDouble(); System.out.println("Enter the no of certification complete:"); int certi = sc.nextInt(); certification = new String[certi]; if(certi > 0){ System.out.println("Enter the Certification names:"); for(int i = 0; i < certification.length; i++){ certification[i] = sc.next(); } } Employee e1 = new Employee(eid, sal, certification); System.out.println("Your rating is " + e1.getRating()); System.out.println("Increment amount is " + String.format("%.2f", e1.calculateIncrement())); System.out.println("Current salary " + String.format("%.2f", e1.getSalary())); } }
public class Employee{ private String employeeId; private double salary; private String[] certification; private int rating; public Employee(){ } public Employee(String id, double sal, String[] certi){ employeeId = id; salary = sal; certification = certi; } public void findRating(){ rating = 0; for(int j = 0; j < certification.length; j++){ if(certification[j].equals("JAVA") || certification[j].equals("ORACLE") || certification[j].equals("GCUX") || certification[j].equals("CCNA") || certification[j].equals("AWS")) rating++; } } public double getSalary(){ return salary; } public int getRating(){ this.findRating(); return rating; } public double calculateIncrement(){ this.findRating(); double increment = 0; switch(rating){ case 1: increment = salary * 2 / 100; salary = salary + increment; return increment; case 2: increment = salary * 3.5 / 100; salary = salary + increment; return increment; case 3: increment = salary * 5 / 100; salary = salary + increment; return increment; case 4: increment = salary * 7.5 / 100; salary = salary + increment; return increment; case 5: increment = salary * 10 / 100; salary = salary + increment; return increment; default: salary += increment; return increment; } } }