Ive been sitting in 3 hours trying to figure out whats wrong, read in my book, seen the Powerpoint and google search and now im giving up.. This is my last resort and I hope to learn how to do it.. Would appriciate the help guys.
Well, here i post my (what I have so far):
// ***************************************************************
// Salary.java
//
// Computes the amount of a raise and the new
// salary for an employee. The current salary
// and a performance rating (a String: "Excellent",
// "Good" or "Poor") are input.
// ***************************************************************
import java.util.Scanner;
import java.text.NumberFormat;
public class Salary
{
public static void main (String[] args)
{
double currentSalary; // employee's current salary
double raise; // amount of the raise
double newSalary; // new salary for the employee
String rating; // performance rating
Scanner scan = new Scanner(System.in);
System.out.print ("Enter the current salary: ");
currentSalary = scan.nextDouble();
System.out.print ("Enter the performance rating (Excellent, Good, or Poor): ");
rating = scan.next();
// Compute the raise using if ...
// Comparation of String is a little different than int. We use a
// String method equals as follow:
//HERE i have problem, I think this is the only
//Thing thats left to fix..
if (rating.equalsIgnoreCase("Exellent"))
{
raise = 0.06
}
if (rating.equalsIgnoreCase("Good"))
{
raise = 0.04
}
if (rating.equalsIgnoreCase("Poor"))
{
raise = 0.015
}
newSalary = currentSalary + raise;
// Print the results
NumberFormat money = NumberFormat.getCurrencyInstance();
System.out.println();
System.out.println("Current Salary: " + money.format(currentSalary));
System.out.println("Amount of your raise: " + money.format(raise));
System.out.println("Your new salary: " + money.format(newSalary));
System.out.println();
}
}
Thx