Guest User

Untitled

a guest
Dec 14th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | None | 0 0
  1. // * * * * * * * * * * * * * * * * * * * * * * * * *
  2. // This program determines gross pay for a company's
  3. // employees.
  4. // Inputs: hoursWorked, rate
  5. // Outputs: grossPay
  6. // Written by: J Chuhaloff
  7. // Last Modified: Oct 2, 2012
  8. // * * * * * * * * * * * * * * * * * * * * * * * * *
  9. import java.util.Scanner;
  10. public class HW6 {
  11.   public static void main (String[] args)  {
  12.     int hoursWorked;
  13.     double rate;
  14.     double grossPay;
  15.     Scanner stdin = new Scanner(System.in);
  16. ;
  17.     System.out.print("\nEnter the rate of pay: ");
  18.     rate = stdin.nextDouble();
  19.     System.out.print("\nEnter the number of hours worked: ");
  20.     hoursWorked = stdin.nextInt();
  21.    
  22.     if  (rate <= 40)  {
  23.         rate = rate * 1.0;
  24.         System.out.print(rate * hoursWorked);
  25.       }
  26.       else  {
  27.         rate = rate * 1.5;
  28.         System.out.print(rate * hoursWorked);
  29.       }
  30.     while (hoursWorked != -1); {
  31.         System.out.print("\nGross Pay: ");
  32.         System.out.print(grossPay = rate * hoursWorked);
  33.       }
  34.   }
  35. }
Add Comment
Please, Sign In to add comment