3. 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 (1=excellent, 2=good, and 3=poor). 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. // ************************************************************** // // 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); } }
Added by Manuela H.
Close
Step 1
The program starts by importing the Scanner class from the java.util package. Show more…
Show all steps
Your feedback will help us improve your experience
Christian Otero and 71 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
write a Python program. Your program is going to compare the distinct salaries of two individuals for the last 5 years. If the salary for the two individual for a particular year is exactly the same, you should print an error and make the user enter both the salaries again for that year. (The condition is that there salaries should not be the exact same). Your program should accept from the user the salaries for each individual one year at a time. When the user is finished entering the salaries, the program should print which individual made the highest total salary over the 5 year period. This is the individual whose salary is the highest. You have to use arrays and loops in this assignment. In the sample output examples, what the user entered is shown in italics. Welcome to the winning card program. Enter the salary individual 1 got in year 1 >10000 Enter the salary individual 2 got in year 1 >50000 Enter the salary individual 1 got in year 2 >30000 Enter the salary individual 2 got in year 2 >50000 Enter the salary individual 1 got in year 3 >35000 Enter the salary individual 2 got in year 3 >105000 Enter the salary individual 1 got in year 4 >85000 Enter the salary individual 2 got in year 4 >68000 Enter the salary individual 1 got in year 5 >75000 Enter the salary individual 2 got in year 5 >100000 Individual 2 has the highest salary.
Gio M.
Expert Q&A: Features of Java You will write a Java application to compute and display the number of months needed to pay off credit card debt. Your program will prompt the user for the following three things: the amount which is the amount of money owed on the credit card, the interest rate in percent, and the amount the user plans to pay the credit card company each month. Based on these inputs, the program will compute the number of months required to pay the debt. It will also compute the total amount paid to the credit card company after all payments are made, the total amount of interest paid, and the overpayment. The total amount paid to the credit card company is the ceiling of the number of months needed multiplied by the monthly amount (which is provided by the user) subtracted from the total amount paid to the credit card company. The overpayment is the amount overpaid to the credit card company, which is an algorithm you'll have to figure out. Details about these computations are given in the Program Requirements section. The following is a sample run, and the input (shown in bold for demonstration purposes only) and output of your submitted program should be formatted the same way as it runs in Eclipse's console or on a command line. Additional sample runs are included at the end of this document. Principal: $580.60 Interest Rate (X): 15.9% Monthly Payment: $106.00 Months Needed To Pay Off: 79 Total Amount Paid: $790.00 Total Interest Paid: $37986.66 Overpayment: $4.43
Akash M.
Write a Java program to initialize the earnings of an employee. The program should calculate the income tax to be paid by the employee based on the following criteria: Slab rate IT rate Upto Rs. 50,000 Nil Upto Rs. 60,000 10% on additional amount Upto Rs. 1,50,000 20% on additional amount Above Rs. 1,50,000 30% on additional amount (Hint: - Run: - java calculates 1,25,000)
Shelayah R.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Watch the video solution with this free unlock.
EMAIL
PASSWORD