Site Loader
Get a Quote
Rock Street, San Francisco

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
//The purpose of the project is to calculate the employee salary raise based on three ratings, if an employee is rating was Excellent he or she will receive 10% rise, if an employee rating was good he or she will receive 5% raise and if an employee rating is poor he or she will receive 2% rise.
//The program will calculate the salary after the it increased and print the employee performance, the user is asked to inter the employee current salary and after that inter the performance rating (Excellent , Good ,Poor) and after that the program will print the new salary.
//We had difficulty in raining the program because of an incorrect cods, so in the end we used if-else statement instead of using switch because we have full knowledge of if-statement, overall working with the system was an interesting experience.

package salary;

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!


order now

/**
*
* @author Use amna obaid rashid,Naima Abdillahi u141220331
*
*/
import java.util.Scanner;
import java.text.NumberFormat;

public class Salary {

/**
* @param args the command line arguments
*/
public static void main(String args) {
// TODO code application logic here
double currentSalary; // code for the employee current salary
double raise; // code for the amount of the rise
double percentRaise;
double newSalary; // code for the new salary for the employee
String rating; // code for the performance rate
Scanner scan = new Scanner(System.in);
System.out.print (“Enter the current salary: “); // code for asking the user to inter salary
currentSalary = scan.nextDouble();
System.out.print (“Enter the performance rating (Excellent, Good, or Poor): “);// code for printing the performance

rating = scan.next();
if

(“Excellent” ==rating); //code for checking condition for Excellent
{
percentRaise = .1;
raise = currentSalary * percentRaise;
}
if (“Good” ==rating); // code for checking condition for good
{

percentRaise = .05;
raise = currentSalary * percentRaise;
}
if (“Poor” == rating) // code checking condition for poor
{
percentRaise = .02;
raise = currentSalary * percentRaise;
}
newSalary = currentSalary + raise;
NumberFormat money =
NumberFormat.getCurrencyInstance();
System.out.println();
System.out.println(“Current Salary: ” + money.format(currentSalary)); // code for peinting the current salary
System.out.println(“Amount of your raise: ” + money.format(raise));// code for printing the salary after the raise
System.out.println(“Your new salary: ” + money.format(newSalary));// code for printing the new salary
System.out.println();

}
}

Post Author: admin

x

Hi!
I'm Lillian

Would you like to get a custom essay? How about receiving a customized one?

Check it out