Using a switch Statement Summary In this lab, you complete a prewritten Java program that calculates an employee's end-of-year bonus and prints the employee's name, yearly salary, performance rating, and bonus. In this program, bonuses are calculated based on an employee's annual salary and their performance rating. Below, Table 4-5 shows the employee ratings and bonuses: D Table 4-5 & Instructions ℗ Rating Bonus 1 2 3 Grading 4 25% of annual salary 15% of annual salary 10% of annual salary None 1. Variables have been declared for you, and the input statements and output statements have been written. Read them over carefully before you proceed to the next step. 2. Design the logic and write the rest of the program using a switch statement. 3. Execute the program entering the following as input: Employee's name: Jeanne Hanson Employee's salary: 70000.00 Employee's performance rating: 2 4. Confirm that your output matches the following: Employee Name: Jeanne Hanson Employee Salary: $70000.0 Employee Rating: 2 Employee Bonus: $10500.0 horam click the Submit button to record your EmployeeBonus2.java + 1 // EmployeeBonus2.java - This program calculates an employee's yearly bonus. 2 3 import java.util.Scanner; 4 5 public class EmployeeBonus2 6 { 7 8 9 10 11 12 13 14 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 } public static void main(String args[]) // Declare and initialize variables. String employeeName; String salaryString; double employeeSalary; String ratingString; int employeeRating; } double employeeBonus; final double BONUS_1 = final double BONUS_2 = 25; 15; 10; final double NO BONUS = 0.00; final double BONUS_3 = final int RATING 1 = 1; final int RATING 22; final int RATING 3 = 3; // This is the work done in the housekeeping() method // Get user input. Scanner input = new Scanner(System.in); System.out.print("Enter employee's name: "); employeeName = input.nextLine(); System.out.print("Enter employee's yearly salary: "); System.out.print("Enter employee's performance rating: "); salaryString input.nextLine(); ratingString input.nextLine(); // Convert Strings to int or double. Double.parseDouble(salaryString); employeeSalary employeeRating = Integer.parseInt(ratingString); // This is the work done in the detailLoop() method // Use switch statement here to calculate bonus based on rating. // This is the work done in the endOf Job() method // Output. System.out.println("Employee Name employeeName); System.out.println("Employee Salary $" employeeSalary); System.out.println("Employee Rating employeeRating); System.out.println("Employee Bonus $* employeeBonus); " + System.exit(0);

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
CENGAGE MINDTAP
L04.4-Using a switch Statement in Java
=
Latel
</>
Using a switch Statement
Summary
In this lab, you complete a prewritten Java program that calculates an employee's
end-of-year bonus and prints the employee's name, yearly salary, performance
rating, and bonus. In this program, bonuses are calculated based on an employee's
annual salary and their performance rating. Below, Table 4-5 shows the employee
ratings and bonuses:
4
Table 4-5
&
Instructions
Rating Bonus
1
2
3
4
25% of annual salary
15% of annual salary
10% of annual salary
None
1. Variables have been declared for you, and the input statements and output
statements have been written. Read them over carefully before you proceed to
the next step.
2. Design the logic and write the rest of the program using a switch statement.
3. Execute the program entering the following as input:
Employee's name: Jeanne Hanson.
Employee's salary: 70000.00
Employee's performance rating: 2
4. Confirm that your output matches the following:
Employee Name: Jeanne Hanson
Employee Salary: $70000.0
Employee Rating: 2
Employee Bonus: $10500.0
Grading
When you have completed your program, click the Submit button to record your
EmployeeBonus2.java +
1 // EmployeeBonus2.java - This program calculates an employee's yearly bonus.
2
3 import java.util.Scanner;
4
5 public class EmployeeBonus2
6 {
7 public static void main(String args[])
8
{
9
// Declare and initialize variables.
String employeeName;
String salaryString;
double employeeSalary;
String ratingString;
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50}
}
Tent
int employeeRating;
double employeeBonus;
RA
final double BONUS_1 = 25;
100 COU
final double BONUS_2= .15;
final double BONUS_3 = 10;
final double NO BONUS = 0.00;
final int RATING 1 = 1;
final int RATING 2H2;
final int RATING 3 = 3;
// This is the work done in the housekeeping() method
// Get user input.
Scanner input = new Scanner(System.in);
System.out.print("Enter omployee's name: ");
employeeName = input.nextLine();
System.out.print("Enter employee's yearly salary: ");
System.out.print("Enter employee's performance rating: ");
salaryString input.nextLine();
ratingString input.nextLine();
// Convert Strings to int or double.
employeeSalary
Double.parseDouble(salaryString);
employee Rating = Integer.parseInt(ratingString);
// This is the work done in the detailLoop() method
// Use switch statement here to calculate bonus based on rating.
// This is the work done in the endOf Job() method
// Output.
System.out.println("Employee Name "employeeName);
System.out.println("Employee Salary $" + employeeSalary);
System.out.println("Employee Rating" + employeeRating);
System.out.println("Employee Bonus $" + employeeBonus);
System.exit(0);
Transcribed Image Text:CENGAGE MINDTAP L04.4-Using a switch Statement in Java = Latel </> Using a switch Statement Summary In this lab, you complete a prewritten Java program that calculates an employee's end-of-year bonus and prints the employee's name, yearly salary, performance rating, and bonus. In this program, bonuses are calculated based on an employee's annual salary and their performance rating. Below, Table 4-5 shows the employee ratings and bonuses: 4 Table 4-5 & Instructions Rating Bonus 1 2 3 4 25% of annual salary 15% of annual salary 10% of annual salary None 1. Variables have been declared for you, and the input statements and output statements have been written. Read them over carefully before you proceed to the next step. 2. Design the logic and write the rest of the program using a switch statement. 3. Execute the program entering the following as input: Employee's name: Jeanne Hanson. Employee's salary: 70000.00 Employee's performance rating: 2 4. Confirm that your output matches the following: Employee Name: Jeanne Hanson Employee Salary: $70000.0 Employee Rating: 2 Employee Bonus: $10500.0 Grading When you have completed your program, click the Submit button to record your EmployeeBonus2.java + 1 // EmployeeBonus2.java - This program calculates an employee's yearly bonus. 2 3 import java.util.Scanner; 4 5 public class EmployeeBonus2 6 { 7 public static void main(String args[]) 8 { 9 // Declare and initialize variables. String employeeName; String salaryString; double employeeSalary; String ratingString; 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50} } Tent int employeeRating; double employeeBonus; RA final double BONUS_1 = 25; 100 COU final double BONUS_2= .15; final double BONUS_3 = 10; final double NO BONUS = 0.00; final int RATING 1 = 1; final int RATING 2H2; final int RATING 3 = 3; // This is the work done in the housekeeping() method // Get user input. Scanner input = new Scanner(System.in); System.out.print("Enter omployee's name: "); employeeName = input.nextLine(); System.out.print("Enter employee's yearly salary: "); System.out.print("Enter employee's performance rating: "); salaryString input.nextLine(); ratingString input.nextLine(); // Convert Strings to int or double. employeeSalary Double.parseDouble(salaryString); employee Rating = Integer.parseInt(ratingString); // This is the work done in the detailLoop() method // Use switch statement here to calculate bonus based on rating. // This is the work done in the endOf Job() method // Output. System.out.println("Employee Name "employeeName); System.out.println("Employee Salary $" + employeeSalary); System.out.println("Employee Rating" + employeeRating); System.out.println("Employee Bonus $" + employeeBonus); System.exit(0);
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Program on Numbers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education