View the step-by-step solution to:

QUESTION?

QUESTION? 

  • Complete the following 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 (, , and ).

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. 
 What if no raise is entered?




// ************************************************************

//   Salary.java

//   Computes the raise and new salary for an employee

// ************************************************************

import java.util.Scanner;

public class Salary

{

    public static void main (String[] args)

    {

            double currentSalary;  // current annual salary

            double rating;             // performance rating

            double raise;              // dollar amount of the raise

            Scanner scan = new Scanner(System.in);

            // Get the current salary and performance rating

            System.out.print ("Enter the current salary: ");

            currentSalary = scan.nextDouble();

System.out.print ("Enter the performance rating: ");

            rating = scan.nextDouble();

            // Compute the raise -- Use if ... else ..

           


             // Print the results

            System.out.println ("Amount of your raise: $" + raise);

            System.out.println ("Your new salary: $" + currentSalary + raise);


 }

}

Top Answer

/*---------------------------------------------... View the full answer

1 comment
  • hope it helps :)
    • J.Campbell
    • Jul 20, 2016 at 10:10am

Sign up to view the full answer

Other Answers

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online