6% to a person's salary who's rating = 1
4% to a person's salary who's rating = 2
2% to a person's salary who's rating = 3
1% to a person's salary who's rating = 4
Current code:
import java.util.Scanner; import java.text.NumberFormat; import java.util.Locale; public class Project5A1 { public static void main (String[] args) { double currentSalary; int rating; int raise; int double raise = 0; Scanner scan = new Scanner(System.in); System.out.print ("Enter the current salary: "); currentSalary = scan.nextDouble(); System.out.print ("Enter the performance rating: "); rating = scan.nextInt(); NumberFormat dollar = NumberFormat.getCurrencyInstance(Locale.US); System.out.println ("Amount of your raise: " + dollar.format(raise)); System.out.println ("Your new salary: " + dollar.format(currentSalary + raise)); } }
I've never done a switch statement, let alone know how it's set up. It's obvious at what the switch statement does, but I wouldn't have a clue how to write it in this program. My book only covers the term but doesn't give an example. I've searched all over the place for an example or instructions but have failed to find any. Any help would be appreciated. Thanks guys
Edited by Scyrus, 20 February 2006 - 07:09 PM.