Lab exercise Complete the following exercisesin yourlab sess

Lab exercise Complete the following exercisesin yourlab session. Do not forget to ask your TA for any help you need. 1. Control statements: Lab4.java Go ahead and download the file Lab4.java from blackboard to your working folder on your computer. Complete this program to determine the raise and new salary for an employee by adding \"if... else\' statements to compute the raise. The input to the program includes the current annual salary for the employee and a number indicating the performance rating (1 excellent, 2 good, and 3 poor). Compute the raise as follows: An employee with a rating of 1 will receive a 6% raise, an employee with a rating of 2 will receive a 4% raise, and one with a rating of 3 will receive a 1.5% raise. Submission Instructions: Name your program for the question 1 as follows Lab4.java. And this file needs to be submitted using the Submit Labs/Assignments button in the blackboard site. (In the submission site, you need to login using the account that you have created before, and choose Lab Submission and \"Lab4\") Make sure that your file has your name, lab letter, and a description of your program in comments.

Solution

Java code:

import java.util.Scanner;

public class salary
{

public static void main(String[] args)
{
double current_salary;
int rating;
Scanner scanner = new Scanner(System.in);
System.out.println(\"Enter current salary: \");
current_salary = scanner.nextFloat();
   System.out.println(\"Enter rating: \");
rating = scanner.nextInt();
if(rating == 1)
{
   System.out.println(\"The Amount raise in the salary is : \" + (current_salary*0.06 ));
   System.out.println(\"The Total Amount of new salary is : \" + ((current_salary*0.06 ) + current_salary));
   }
   else if (rating == 2)
   {
   System.out.println(\"The Amount raise in the salary is : \" + (current_salary*0.04 ));
   System.out.println(\"The Total Amount of new salary is : \" + ((current_salary*0.04 ) + current_salary));
   }
   else
   {
   System.out.println(\"The Amount raise in the salary is : \" + (current_salary*0.015 ));
   System.out.println(\"The Total Amount of new salary is : \" + ((current_salary*0.015 ) + current_salary));
   }

}

}

Sample Output:

Enter currenr salary:
100
Enter rating:
1
The Amount raise in the salary is : 6.0
The Total Amount of new salary is : 106.0

Enter currenr salary:
100
Enter rating:
2
The Amount raise in the salary is : 4.0
The Total Amount of new salary is : 104.0

Enter currenr salary:
100
Enter rating:
3
The Amount raise in the salary is : 1.5
The Total Amount of new salary is : 101.5

 Lab exercise Complete the following exercisesin yourlab session. Do not forget to ask your TA for any help you need. 1. Control statements: Lab4.java Go ahead
 Lab exercise Complete the following exercisesin yourlab session. Do not forget to ask your TA for any help you need. 1. Control statements: Lab4.java Go ahead

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site