lab7
This commit is contained in:
BIN
labs/lab5/Salary.class
Normal file
BIN
labs/lab5/Salary.class
Normal file
Binary file not shown.
36
labs/lab5/Salary.java
Normal file
36
labs/lab5/Salary.java
Normal file
@ -0,0 +1,36 @@
|
||||
// ***************************************************************
|
||||
// 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 = 0; // 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 ...
|
||||
|
||||
if (rating == 1) {
|
||||
raise = currentSalary * 0.06;
|
||||
} else if (rating == 2) {
|
||||
raise = currentSalary * 0.04;
|
||||
} else if (rating == 3) {
|
||||
raise = currentSalary * 0.015;
|
||||
} else {
|
||||
System.out.println("Rating not correctly entered!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Print the results
|
||||
System.out.println ("Amount of your raise: $" + raise);
|
||||
System.out.println ("Your new salary: $" + (currentSalary + raise));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user