Advertisement
476179

payroll Dialog

Oct 10th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. package lessons;
  2. import javax.swing.JOptionPane;
  3. public class PayrollDialog
  4. {
  5. //ask for name, hours worked, and payrate, then greets them withtheir name and gross pay
  6. public static void main(String[] args)
  7. {
  8. String name, hour, rate;
  9. double hours, rates, gross;
  10. name = JOptionPane.showInputDialog("hello, whats your name?");
  11. hour = JOptionPane.showInputDialog("how many hours have you worked?");
  12. hours = Double.parseDouble(hour);
  13. rate = JOptionPane.showInputDialog("whats your pay rate?");
  14. rates = Double.parseDouble(rate);
  15. gross = rates*hours;
  16. JOptionPane.showMessageDialog(null, "greetings "+name+", youve made $"+gross);
  17. System.exit(0);
  18.  
  19. }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement