Question

In: Computer Science

Directions: Create a program that takes as input an employee's salary and a rating of the...

Directions: Create a program that takes as input an employee's salary and a rating of the employee's performance and then computes the appropriate raise for the employee based on that rating. The performance rating is entered into the program as a String. The three possible ratings are "Outstanding", "Acceptable", and "Needs Improvement". An employee who is rated as Outstanding will receive a 10.2% raise, one rated Acceptable will receive a 7% raise, and one rated as Needs Improvement will receive a 1.2% raise.

Add the if... else... statements to program PerformanceRating to make it run as described above. Note that you will have to use the equals method of the String class (not the relational equality operator ==) to compare two strings (the user input and the rating).

You should also note how the NumberFormat class from the text package is being used to format currency in this lab.

Download the Performance Rating instructions and the Performance Rating source file. Follow your teacher's instructions for submitting the .java file and a screenshot from the BlueJ terminal window.

The .equals() method will compare two strings and return true if the strings are identical and false if the strings differ at all.

1. Create a hand drawn flow chart showing the logic of the if... else...statements

2. Open PerformanceRating. Copy and paste the code from this document intoBlueJ.

3. Add your identifying information to the comments at the top of the code

4. Finish the code to execute the if...else and accurately calculate the raise.

5. Test your code for: a. Rating of Outstanding b. Rating of Acceptable c. Rating of Needs Improvement

.

Here is an example of using the .equals() method:

System.out.print ("Enter the day of the week (Sunday, Monday, etc.): "); String day = scan.next();

if (day.equals("Sunday"))

System.out.println("Stay at home.");

else

System.out.prntln("Go to school.");

Solutions

Expert Solution

Positive ratings needed. Thank you.

Flow Chart :

Java Code :

import java.util.*;
import java.io.*;

public class Main
{
   public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
       double salary;
       System.out.println("Enter the salary of the employee: ");
       salary = sc.nextFloat(); /// input the salary
       System.out.println("Enter the Performance rating of the employee: ");
       String PerformanceRating = sc.next(); /// input the Performance Rating
       if(PerformanceRating.equals("Outstanding"))
       {
       salary = salary + salary * 0.102; /// if the rating is Outstanding then raise will be 10.2%
       System.out.println("Salary of the employee after the raise: "+salary);
       }
       else if(PerformanceRating.equals("Acceptable"))
       {
       salary = salary + salary * 0.07; /// if the rating is Acceptable then raise will be 7%
       System.out.println("Salary of the employee after the raise: "+salary);
       }
       else
       {
       salary = salary + salary * 0.012; /// if the rating is Need Improvement then raise will be 1.2%
       System.out.println("Salary of the employee after the raise: "+salary);
      
       }
   }
}

Output:



Related Solutions

I need someone to create a program for me: Create a program that takes as input...
I need someone to create a program for me: Create a program that takes as input an employee's salary and a rating of the employee's performance and computes the raise for the employee. The performance rating here is being entered as a String — the three possible ratings are "Outstanding", "Acceptable", and " Needs Improvement ". An employee who is rated outstanding will receive a 10.2 % raise, one rated acceptable will receive a 7 % raise, and one rated...
Create the logic for a rhyming program that takes in five words from a user input...
Create the logic for a rhyming program that takes in five words from a user input and replaces the selected rhyming words with the user's input, then creates and displays the Humpty Dumpty rhyme with the five words from the user input. Hint: 1. You will use the sentinel values: start and stop 2. The program will ask the user for 5 words. 3. The program will store the 5 words 4. The program outputs the rhyme replacing the ____...
Write a program that takes a date as input and outputs the date's season. The input...
Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month and an int to represent the day. Ex: If the input is: April 11 the output is: Spring In addition, check if the string and int are valid (an actual month and day). Ex: If the input is: Blue 65 the output is: Invalid The dates for each season are: Spring: March 20 - June 20 Summer:...
Write a program in Python that - Takes in a gross salary. - If the gross...
Write a program in Python that - Takes in a gross salary. - If the gross salary is above €50.000 taxes are 50%. - If the gross salary is above €25.000 taxes are 25%. - If the gross salary is above €10.000 taxes are 10%. - If the gross salary is below €10.000 there is no tax. - Output the gross salary and the net income. Note: Give the pseudocode of your program.
Write a short C++ program that takes all the lines input to standard input and writes...
Write a short C++ program that takes all the lines input to standard input and writes them to standard output in reverse order. That is, each line is output in the correct order, but the ordering of the lines is reversed. Please use vector datatype standaard library #include <vector> Thanks
Write a program that takes in a positive integer as input, and outputs a string of...
Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binary. For an integer x, the algorithm is: As long as x is greater than 0 Output x % 2 (remainder is either 0 or 1) x = x / 2 Note: The above algorithm outputs the 0's and 1's in reverse order. Ex: If the input is: 6 the output is: 011 6 in binary is...
IN PYTHON Write a program that takes in a positive integer as input, and outputs a...
IN PYTHON Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binary. For an integer x, the algorithm is: As long as x is greater than 0 Output x % 2 (remainder is either 0 or 1) x = x // 2 Note: The above algorithm outputs the 0's and 1's in reverse order. You will need to write a second function to reverse the string....
Write a program that takes in a line of text as input, and outputs that line...
Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending when the user enters "Quit", "quit", or "q" for the line of text. Ex: If the input is: Hello there Hey quit then the output is: ereht olleH yeH IN C++ PLEASE!
Java Code: Write an application that takes in user input. (Name, Age, and Salary) ------ Write...
Java Code: Write an application that takes in user input. (Name, Age, and Salary) ------ Write an application that includes a constructor, user input, and operators.
(JAVA) Create a program that prompts the user for an age input. The program defines the...
(JAVA) Create a program that prompts the user for an age input. The program defines the age group of the user. Follow the table below to construct the output for your program. Age Age Group 0 Baby 1-3 Toddler 4-11 Child 12-17 Teenager 18-21 Young Adult 22-64 Adult 65+ Senior Negative Number Invalid Input Sample Input Enter an age: 18 Sample Output: You are a young adult. Sample Input Enter an age: 29 Sample Output: You are an adult. Sample...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT