Skip to content

Instantly share code, notes, and snippets.

@atticoos
Created September 24, 2013 02:49
Show Gist options
  • Save atticoos/6679771 to your computer and use it in GitHub Desktop.
Save atticoos/6679771 to your computer and use it in GitHub Desktop.
import javax.swing.JOptionPane;
public class Salary1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
//define the variables for the input box
int hourlyPay,
regHours,
overtimeHours = 0;
double overtimePay = 0;
hourlyPay = Integer.parseInt(JOptionPane.showInputDialog("How much is your hourly pay rate (full dollar amounts) ?"));
regHours = Integer.parseInt(JOptionPane.showInputDialog("How many hours do you work a week?"));
overtimeHours = Integer.parseInt(JOptionPane.showInputDialog("How many overtime hours did you work?"));
JOptionPane.showMessageDialog(null, hourlyPay +" " + regHours + " " + overtimeHours );
JOptionPane.showMessageDialog(null, "Overtime pay is... $" + overtimePay);
}
public Salary1(int hourlyPay, int regHours, int overtimeHours, double overtimePay) {
overtimePay = (regHours * hourlyPay) + (overtimeHours * (1.5 * hourlyPay) );
return;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment