Advertisement
Classnotes

Untitled

Feb 19th, 2020
494
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.36 KB | None | 0 0
  1. package Comet;
  2.  
  3. import java.util.Scanner;
  4.  
  5.  
  6. public class comet_class {
  7.  
  8.     public static void main(String[] args) {
  9.  
  10.         Scanner sc = new Scanner(System.in);
  11.  
  12.         String employeeIdentity;
  13.         String projectCode;
  14.  
  15.         double billableHours = 0;
  16.         double totalBillable = 0;
  17.         double averageBillable = 0;
  18.         double overtimeHours = -30;
  19.         double overtimeBonus = 0;
  20.         double nonBillableHours = 7.5;
  21.  
  22.         System.out.println("Enter Employee Code");
  23.         employeeIdentity = sc.next();
  24.  
  25.  
  26.         //Days for Loop
  27.         for(int i  = 1; i < 5; i++) {
  28.  
  29.  
  30.             // Hours for loop also used for project numbering
  31.             for (int p = 1; p < 4; p++){
  32.  
  33.  
  34.                 // Project Code Input
  35.                 System.out.println("Day " +i+ " Enter Project Code "+p);
  36.                 projectCode = sc.next();
  37.  
  38.                 // Skipping day if project code equals ZZ
  39.                 if(projectCode.equals("ZZ")) {
  40.                     break;
  41.                 //Print line for hours worked on project
  42.                 }
  43.                 else {
  44.                     System.out.println("Enter Hours Worked on Project "+p);
  45.                     billableHours = sc.nextDouble();
  46.                 //If the hours are above 30 the overtime hours are counted
  47.                 }
  48.                 if(totalBillable > 30);
  49.                 overtimeHours = totalBillable + overtimeHours;
  50.                
  51.                 //If they are less than 30 overtime hours remain at 0
  52.                 if(totalBillable <= 30);
  53.                 overtimeHours = 0;
  54.                
  55.  
  56.                 totalBillable = totalBillable + billableHours;
  57.                 averageBillable = totalBillable/i;
  58.                 overtimeBonus = 20*overtimeHours;
  59.             }
  60.    
  61.             //end of day
  62.            
  63.             billableHours = 0;
  64.         }
  65.  
  66.         //end of week print outs
  67.         System.out.println("\nTotal Billable Hours: " +totalBillable);
  68.         System.out.println("Total Non-Billable Hours: "+nonBillableHours);
  69.         System.out.println("Total Overtime Hours: "+overtimeHours);
  70.         System.out.println("Average Daily Billable Hours Worked: "+averageBillable);
  71.         System.out.println("Project with most hours in 1 Day: ");
  72.         System.out.println("Bonus: €"+overtimeBonus);
  73.        
  74.     }
  75.  
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement