WageCommuter - HourlyWage = Double.parseDouble(Input);...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
import javax.swing.*; import java.util.*; import java.text.*; public class WageComputer { private String Input; private int HoursWorked, HoursOT, HoursReg; private Double HourlyWage, TotalSales, Wage, OTPay, WagePay, CPay; public static final int RegReqHrs = 40; public static final Double RateOT = 1.5; public static final Double CM1 = .05; public static final Double CM2 = .1; public static final Double CM3 = .15; public WageComputer() { HoursWorked = 0; HoursOT = 0; HoursReg = 0; HourlyWage = 0.0; TotalSales = 0.0; Wage = 0.0; OTPay = 0.0; WagePay = 0.0; CPay = 0.0; } public void start(){ JOptionPane.showMessageDialog(null, "This program will calculate your wages, be prepared to enter the following data: \n" + " Hours Worked\n Hourly Wage\ n Total Sales"); } public void getNumbers(){ Input = JOptionPane.showInputDialog(null, "Hours Worked : "); HoursWorked = Integer.parseInt(Input); Input = JOptionPane.showInputDialog(null, "Hourly Wage : ");
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: HourlyWage = Double.parseDouble(Input); Input = JOptionPane.showInputDialog(null, "Total Sales : "); TotalSales = Double.parseDouble(Input); if (HoursWorked > RegReqHrs) { HoursOT = HoursWorked - RegReqHrs; HoursReg = RegReqHrs; } else { HoursReg = HoursWorked; } OTPay = HoursOT * (HourlyWage * RateOT); WagePay = HoursReg * HourlyWage; if (TotalSales>=1.00 && TotalSales <=99.99){ CPay = TotalSales * CM1; } else{ if (TotalSales >99.99 && TotalSales <= 299.99){ CPay = TotalSales * CM2; } else { if (TotalSales >= 300.00){ CPay = TotalSales * CM3; } } } } public void wageCompute(){ Wage = OTPay + WagePay + CPay; JOptionPane.showMessageDialog(null, "Your Regular Wage was : " + WagePay + "\nYour Overtime Pay was : " + OTPay + "\nYour Commission was : " + CPay + "\n Therefore your total pay was : " + Wage); } }...
View Full Document

Page1 / 3

WageCommuter - HourlyWage = Double.parseDouble(Input);...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online