Sat May 30, 2009 6:16 pm
import javax.swing.JOptionPane;
public class Pay
{
public static void main(String[] args)
{
String hoursString, skillLevelRateString, skillLevelString;
double hoursWorked = 0;
double regularPay = 0;
double overtimePay = 0;
double skillLevelRate = 0;
int skillLevel = 0;
final int SKILL_ONE = 1;
final int SKILL_TWO = 2;
final int SKILL_THREE = 3;
final String OPTION_ONE = "Medical insurance";
final String OPTION_TWO = "Dental insurance";
final String OPTION_THREE = "Long-Term disability insurance";
final double LEVEL_ONE_RATE = 17.00;
final double LEVEL_TWO_RATE = 20.00;
final double LEVEL_THREE_RATE = 22.00;
final double OPTION_ONE_RATE = 32.50;
final double OPTION_TWO_RATE = 20.00;
final double OPTION_THREE_RATE = 10.00;
hoursString = JOptionPane.showInputDialog(null,
"How many hours did you work this week?");
hoursWorked = Double.parseDouble(hoursString);
skillLevelString = JOptionPane.showInputDialog(null,
"What skill level are you?" + "\nEnter Skill level 1, 2 or 3");
skillLevel = Integer.parseInt(skillLevelString);//corrected with help
switch(skillLevel)
{
case 1:
skillLevel = SKILL_ONE;
skillLevelRate = LEVEL_ONE_RATE;
break;
case 2:
skillLevel = SKILL_TWO;
skillLevelRate = LEVEL_TWO_RATE;
break;
case 3:
skillLevel = SKILL_THREE;
skillLevelRate = LEVEL_THREE_RATE;
//etc
}
if(hoursWorked > 40)
{
regularPay = 40 * skillLevelRate; //skillLevelRate allows for changes
overtimePay = (hoursWorked - 40) * 1.5 * skillLevelRate;
}//thanks for help here
else
{
regularPay = 40 * skillLevelRate;
overtimePay = 0.0;
}
JOptionPane.showMessageDialog(null, "Regular pay is " +
regularPay + "\nOvertime pay is " + overtimePay);
System.exit(0);
{
}
}
}
Sat May 30, 2009 6:46 pm
if(x=5 && y = 6)
{
System.out.println("Am here " ) ;
}
Sun May 31, 2009 2:34 pm
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.