Inorder to motivate the employees, the company

has decided to announce the different types of bonus depends up on the employee’s Grade.

If the employee belong to
Grade A bonus=20% basic
Grade B bonus=15% basic
Grade C bonus=10% basic
Grade D bonus=7% basic
Grade E bonus=5% basic
Write a Java program to read the employee code (Integer), employee name (string), Basic salary (double),
Category (Character) then calculate the bonus (double) and the total salary (double) eligible for each
employ. The output should have the employee code, employee name, basic salary, grade bonus and the
total salay. The program must use switch-case construct for calculations. Test your program for
minimum of 5 employees.

Sample Output
Employee code : 1234
Employee Name : aaaaa
Basic Salary : 1000 OMR
Grade : A/B/C/D/E
Bonus : 1111 OMR
Total Salary : Basic salary + Bonus

how to see the answer

See

http://www.jiskha.com/display.cgi?id=1483264139

To solve this problem, you can write a Java program that follows the given requirements. Here's an example solution for you:

```java
import java.util.Scanner;

public class EmployeeBonusCalculator {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

for (int i = 1; i <= 5; i++) {
System.out.println("Employee " + i + " details:");

System.out.print("Employee code: ");
int employeeCode = scanner.nextInt();

System.out.print("Employee name: ");
String employeeName = scanner.next();

System.out.print("Basic salary (OMR): ");
double basicSalary = scanner.nextDouble();

System.out.print("Grade (A/B/C/D/E): ");
char grade = scanner.next().charAt(0);

double bonus;
switch (grade) {
case 'A':
bonus = 0.2 * basicSalary;
break;
case 'B':
bonus = 0.15 * basicSalary;
break;
case 'C':
bonus = 0.10 * basicSalary;
break;
case 'D':
bonus = 0.07 * basicSalary;
break;
case 'E':
bonus = 0.05 * basicSalary;
break;
default:
bonus = 0;
break;
}

double totalSalary = basicSalary + bonus;

System.out.println("Employee code: " + employeeCode);
System.out.println("Employee Name: " + employeeName);
System.out.println("Basic Salary: " + basicSalary + " OMR");
System.out.println("Grade: " + grade);
System.out.println("Bonus: " + bonus + " OMR");
System.out.println("Total Salary: " + totalSalary + " OMR");
System.out.println();
}

scanner.close();
}
}
```

In this program, we use a `Scanner` object to read input from the user. We iterate through a loop to read details for multiple employees. Inside the loop, we prompt the user for each employee detail.

We use a switch-case construct to calculate the bonus based on the grade of the employee. The bonus is calculated by multiplying the basic salary with the corresponding bonus percentage.

Finally, we calculate the total salary by adding the basic salary and the bonus. We then display all the employee details and their calculated bonus and total salary.

You can run this program and provide the necessary input for each employee to get the desired output.