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...
C Program: Create a C program that prints a menu and takes user choices as input....
C Program: Create a C program that prints a menu and takes user choices as input. The user will make choices regarding different "geometric shapes" that will be printed to the screen. The specifications must be followed exactly, or else the input given in the script file may not match with the expected output. Important! Consider which control structures will work best for which aspect of the assignment. For example, which would be the best to use for a menu?...
C Program: Create a C program that prints a menu and takes user choices as input....
C Program: Create a C program that prints a menu and takes user choices as input. The user will make choices regarding different "geometric shapes" that will be printed to the screen. The specifications must be followed exactly, or else the input given in the script file may not match with the expected output. Your code must contain at least one of all of the following control types: nested for() loops a while() or a do-while() loop a switch() statement...
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 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 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:...
I need to create a servlet that takes in an input that will do the following...
I need to create a servlet that takes in an input that will do the following calculations. If the input number is a prime, just output a message showing that it is a prime; If the input number is not a prime and it is an odd integer, write it as a product of two smaller odd integers; If the input number is not a prime and it is an even integer, first extract the largest power of 2, then...
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.
Python Program 1: Write a program that takes user input in the form of a string...
Python Program 1: Write a program that takes user input in the form of a string Break up the string into a list of characters Store the characters in a dictionary The key of the dictionary is the character The value of the dictionary is the count of times the letter appears Hint: remember to initialize each key before using Output of program is the count of each character/letter Sort the output by key (which is the character) Python 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
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT