Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

U.S. federal government employees are paid on a scale according to their grade a

ID: 3538132 • Letter: U

Question

U.S. federal government employees are paid on a scale according to their grade and step. There are a total of 15 grades, each of which consists of 10 steps. Here's a table of 2013 annual salaries ( in $ ) for the first 5 grades and the first 3 steps from each:


Grade   Step 1   Step 2   Step 3

1            20324   21003 21679

2            22851   23395   24151

3            24933   25764   26595

4            27990   28922   29855

5            31315   32359   33402


Write a Java program that uses the switch statement to determine the salary of an employee. Your program should allow the user to enter two inputs: the grade and step. It should then display the appropriate salary based on the table above. You only have to implement the first 5 grades and first 3 steps. Include default cases to cover situations where the user enters an invalid grade or step.Do not use any form of the if statement in your program.


Hint: You can nest switch statements, just as you can nest if statements!

Explanation / Answer

This is the complete solution for your problem...


Copy paste and run ...


Just Change the package name and class name as according to you..

my package name is : q1

my class name is : EmployeeSalary


please rate me if you like the solution ..

thank you !!


solution :

-------------------------------------------------------------------------------------------------------------------------------------------------------------------



package q1;


import java.util.Scanner;


public class EmployeeSalary {


public static void main(String[] args) {

Scanner sc=new Scanner(System.in);

int grade;

int step;

System.out.println("Enter the Grade");

grade=sc.nextInt();

System.out.println("Enter the Step");

step=sc.nextInt();

// TODO Auto-generated method stub


System.out.println("the Employe salary is : ");

switch(grade)

{

case 1:

{

switch(step)

{

case 1: System.out.println("20324");break;

case 2: System.out.println("21003");break;

case 3: System.out.println("21679");break;

default: System.out.println("Invalid Choice");

}

break;

}

case 2:

{

switch(step)

{

case 1: System.out.println("22851");break;

case 2: System.out.println("23395");break;

case 3: System.out.println("24151");break;

default: System.out.println("Invalid Choice");

}

break;

}

case 3:

{

switch(step)

{

case 1: System.out.println("24933");break;

case 2: System.out.println("25764");break;

case 3: System.out.println("26595");break;

default: System.out.println("Invalid Choice");

}

break;

}

case 4:

{

switch(step)

{

case 1: System.out.println("27990"); break;

case 2: System.out.println("28922");break;

case 3: System.out.println("29855");break;

default: System.out.println("Invalid Choice");

}

break;

}

case 5:

{

switch(step)

{

case 1: System.out.println("31315");break;

case 2: System.out.println("32359");break;

case 3: System.out.println("33402");break;

default: System.out.println("Invalid Choice");

}

break;

}

default: System.out.println("Invalid Choice");

}

}


}