import java.util.Scanner;

public class Payroll5
  /** This class demonstrates 
    * */
{
  public static void main(String[] args)
  {
    Scanner scanner = new Scanner(System.in);
    //int numEmployees=0; //use this as my counter 
    int counter=0, idnum=0;
    boolean done=false;
    
    
   // REPEAT the next block until user enters -1 as idnum
    while(!done) { // done==false 
         //counter++; 
         System.out.print("Enter ID number of employee: ");
         idnum = scanner.nextInt();
         System.out.printf("Enter hours and rate for employee #%d: ",idnum);
         int hoursWorked=scanner.nextInt();
         double payPerHour=scanner.nextDouble();
    
         // calculate pay
         double weeklySalary=0.0;  
    
         if (hoursWorked > 40) {
              System.out.println("You worked overtime!");
              // now let's calculate weekly salary with 1 1/2 pay for overtime
              weeklySalary = (hoursWorked-40)*1.5*payPerHour+40*payPerHour;
         }
         else {
              weeklySalary = hoursWorked * payPerHour;
         }
    
         System.out.printf("Weekly salary for employee #%d is: $%.2f. You worked %d " 
                      + "hours at %.2f rate.\n", idnum, weeklySalary,hoursWorked,
                                               payPerHour);
         System.out.print("Do you want to exit? Y/N ");
         String answer = scanner.next();
         if (answer.charAt(0)=='Y' || answer.charAt(0)=='y')
             done = true;
    }
     
  }
}