Skip to content

Instantly share code, notes, and snippets.

@SniperProSerria117
Created October 30, 2014 13:14
Show Gist options
  • Save SniperProSerria117/be545a641552ba94d5e4 to your computer and use it in GitHub Desktop.
Save SniperProSerria117/be545a641552ba94d5e4 to your computer and use it in GitHub Desktop.
package payroll;
import javax.swing.JOptionPane;
public class PayRoll {
public static void main(String[] args) {
String inputString;
String name;
int hours;
double payRate;
double grossPay;
name = JOptionPane.showInputDialog("What is " +
"your name? ");
inputString =
JOptionPane.showInputDialog("How many hours " +
"did you work this week? ");
hours = Integer.parseInt(inputString);
inputString =
JOptionPane.showInputDialog("What is your" +
" hourly pay rate? ");
payRate = Double.parseDouble(inputString);
grossPay = hours * payRate;
JOptionPane.showMessageDialog(null, "Hello " +
name +". Your gross pay is $" +
grossPay);
System.exit(0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment