Question: I'd like to add a loop for repeat or quit in this program. Where should I put a loop? 19 + public static void main(String[]

I'd like to add a loop for repeat or quit in this program. Where should I put a loop? I'd like to add a loop for repeat or quit inthis program. Where should I put a loop? 19 + public static

void main(String[] args) { // TODO code application logic here 20 21

19 + public static void main(String[] args) { // TODO code application logic here 20 21 22 23 24 = 25 = 26 27 28 29 30 31 32 33 8 // create subclass objects SalariedEmployee salariedEmployee new SalariedEmployee ("a", "a", "111-11-1111", 800.00); HourlyEmployee hourlyEmployee new HourlyEmployee ("a", "a", "222-22-2222", 16.75, 40); Commission Employee commission Employee new Commission Employee "a", "a", "333-33-3333", 10000, .06); BasePlusCommission Employee basePlusCommission Employee = new BasePlusCommission Employee "a", "a", "444-44-4444", 5000, .04, 300); PieceWorker pieceWorker = new PieceWorker ("a","a", "555-55-5555",100,24); 3 35 System.out.println("Employees processed individually:"); 36 37 38 39 40 3 1 41 42 43 System.out.printf("%n%s8n8s: $8,.2f8n8n", salariedEmployee, "earned", salariedEmployee.earnings ()); System.out.printf("%s%n%s: $8,.2f8n8n", hourlyEmployee, "earned", hourlyEmployee.earnings()); System.out.printf("$s$n$s: $8,.25%n%n", commission Employee, "earned", commission Employee.earnings ()); System.out.printf("8s8n8s: $8,.2f8n8n", basePlusCommission Employee, "earned", basePlusCommissionEmployee.earnings ()); System.out.printf("$s$n$s: $8,.25%n%n", pieceWorker, HE 44 45 46 1 47 48 "earned", pieceWorker.earnings ()); 49 50 51 // create five-element Employee array Employee [] employees = new Employee [5]; 52 53 54 55 56 // initialize array with Employees employees [0] = salariedEmployee; employees [1] = hourlyEmployee; employees [2] = commission Employee; employees [3] = basePlusCommission Employee; employees [4] pieceWorker; 57 58 59 60 61 System.out.printf ("Employees processed polymorphically: 8n8n"); 62 63 64 // generically process each element in array employees for (Employee current Employee : employees) { System.out.println(current Employee); // invokes toString 65 66 67 68 69 // determine whether element is a BasePlusCommission Employee if (current Employee instanceof BasePlusCommission Employee) { // downcast Employee reference to // BasePlus Commission Employee reference BasePlusCommission Employee employee (BasePlusCommission Employee) current Employee ; 70 71 = 72 73 employee.setBaseSalary(1.10 * employee.getBaseSalary()); 74 75 76 System.out.printf( "new base salary with 108% increase is: $%,.2f%n", employee.getBaseSalary()); } 77 78 79 80 81 System.out.printf( "earned $8,.2f%n%n", current Employee.earnings ()); 82 } 8 83 84 85 8 86 // get type name of each object in employees array for (int j = 0; j

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!