Compute Raise

Compute Raise - int performanceRating = in.nextInt();...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package computeraise; import java.util.Scanner; /** * * @author Manny */ public class ComputeRaise { /** * @param args the command line arguments */ public static void main(String[] args) { //Define constant final double EXCELLENT_RAISE_RATE = .06; final double GOOD_RAISE_RATE = .04; final double IDIOT_RAISE_RATE = .015; // Input System.out.println("Please enter the current annual salary: "); Scanner in = new Scanner(System.in); double currentSalary = in.nextDouble(); System.out.println("Please enter the performance rating (1-excellent, 2-good, 3-idiot):");
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: int performanceRating = in.nextInt(); //Process double salaryAfterRaise = 0; if(performanceRating == 1) { salaryAfterRaise = currentSalary * (1 + EXCELLENT_RAISE_RATE); } else if(performanceRating == 2) { salaryAfterRaise = currentSalary * (1 + GOOD_RAISE_RATE); } else if (performanceRating == 3) { salaryAfterRaise = currentSalary * (1 + IDIOT_RAISE_RATE); } else { System.out.println("Wrong performance rating, please start again"); System.exit(0); } //Output System.out.printf("your salary after raise: $%, .2f\n", salaryAfterRaise); } }...
View Full Document

This note was uploaded on 12/07/2011 for the course BUS 350 taught by Professor Leighjin during the Fall '11 term at S.F. State.

Ask a homework question - tutors are online