Guest User

Untitled

a guest
Jan 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. import javax.swing.JOptionPane;
  2.  
  3. class PayCheck {
  4.     public static void main(String[] args) {
  5.         int hours, rate;
  6.         double pay;
  7.         String input;
  8.  
  9.         input = JOptionPane.showInputDialog("Enter your pay rate: ");
  10.         rate = Integer.parseInt(input);
  11.        
  12.         input = JOptionPane.showInputDialog("Enter your hours: ");
  13.         hours = Integer.parseInt(input);
  14.         if(hours > 40) {
  15.             pay = 40*rate + (hours-40)*rate*1.5;
  16.         } else {
  17.             pay = hours*rate;
  18.         }
  19.  
  20.         JOptionPane.showMessageDialog(null,"Your pay is: " + pay);
  21.  
  22.     }
  23. }
Add Comment
Please, Sign In to add comment