import java.util.Scanner;
/**
 * This class illustrates exercises from the slide deck for the course
 * This is the solution see PayCalc for the starter code
 * 
 * 360-420-DW Intro to Java
 * @author PMCampbell
 * @version today
 * 
 **/
public class PayCalcSolution {
   public static void main(String[] args)    {
   // constants go at the top & must be ALLCAPS and underscores
   final double PAY_RATE = 10.25;
   final double OVERTIME = 1.5;
   final int REG_HOURS = 40;
   // variables next first letter always lower case, the rest camel case
   Scanner keyboard = new Scanner(System.in);
   int hours;
   double regularPay; 
   
   System.out.print("How many hours did you work this week: ");
   hours = keyboard.nextInt();
   
   if (hours > REG_HOURS) {
        regularPay   = PAY_RATE * OVERTIME * (hours - REG_HOURS);
        regularPay += PAY_RATE * REG_HOURS;
   } else {
       regularPay = PAY_RATE * hours;
   } 
   
   // CHALLENGE:   modify to dispaly overtime pay, regular pay and total pay
   
   
    // using println    
    System.out.println("Hours " + hours + " Pay $" + regularPay);
    // using printf
    System.out.printf("Hours %d Pay $%.2f\n", hours, regularPay);
   }
}
@@ -622,16 +622,38 @@
 gularPay
+,overtimePay, totalPay
 ; %0A   %0A 
@@ -749,17 +749,36 @@
 t();%0A   
-%0A
+if (hours %3E 0) %7B%0A   
    if (h
@@ -801,31 +801,33 @@
 ) %7B%0A        
-regular
+ overtime
 Pay   = PAY_
@@ -869,24 +869,25 @@
 S);%0A        
+ 
 regularPay +
@@ -885,17 +885,16 @@
 ularPay 
-+
 = PAY_RA
@@ -916,175 +916,323 @@
 %0A   
-%7D else %7B%0A       regularPay = PAY_RATE * hours;%0A   %7D 
+      totalPay = regularPay + overtimePay;%0A         System.out.println(%22Hours %22 + hours + %22 Pay $%22 + totalPay);
 %0A   
-%0A
+   
    // 
-CHALLENGE:   modify to dispaly overtime pay, regular pay and total pay%0A   %0A   %0A    // using println    %0A
+printf instead of println%0A         System.out.printf(%22Hours %25d Pay $%25.2f Overtime included %25.2f%5Cn%22, hours, totalPay, overtimePay);%0A      %7D else %7B%0A         regularPay = PAY_RATE * hours;%0A     
     
@@ -1301,28 +1301,32 @@
     
-// using printf
+  %7D %0A   %7D else %7B 
 %0A    
+  
 Syst
@@ -1341,56 +1341,93 @@
 rint
-f(%22Hours %25d Pay $%25.2f%5Cn%22, hours, regularPay
+ln(%22Invalid input hours: %22 + hours
 );
+ 
 %0A   %7D%0A%7D
+ // end main()%0A%7D // end PayCalcSolution class

update paycalc solution