Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

//import java.util.Scanner; public class PayrollSystemTest { public static void

ID: 441083 • Letter: #

Question

//import java.util.Scanner; public class PayrollSystemTest { public static void main( String [] args ) { SalariedEmployee salariedEmployee = new SalariedEmployee( "Larry", "Chung", "111-11-1111", 1, 2, 1960, 1000); HourlyEmployee hourlyEmployee = new HourlyEmployee( "Mandy", "Cole", "222-22-2222", 4, 1, 1964, 20, 40 ); CommissionEmployee commissionEmployee = new CommissionEmployee( "Tiny", "Hunt", "333-33-3333", 12000, 2, 1, 1962, .05 ); BasePlusCommissionEmployee basePlusCommissionEmployee = new BasePlusCommissionEmployee( "Lewis", "Knight", "444-44-4444", 10000, 3, 1, 1963, .03, 500 ); System.out.println( "Employee processed individually: " ); System.out.printf( "%s %s: $%,.2f ", salariedEmployee, "earned", salariedEmployee.earnings() ); System.out.printf( "%s %s: $%,.2f ", hourlyEmployee, "earned", hourlyEmployee.earnings() ); System.out.printf( "%s %s: $%,.2f ", commissionEmployee, "earned", commissionEmployee.earnings() ); System.out.printf( "%s %s: $%,.2f ", basePlusCommissionEmployee, "earned", basePlusCommissionEmployee.earnings() ); Employee employees[] = new Employee[ 5 ]; employees[ 0 ] = salariedEmployee; employees[ 1 ] = hourlyEmployee; employees[ 2 ] = commissionEmployee; employees[ 3 ] = basePlusCommissionEmployee; employees[ 4 ] = salariedEmployee; System.out.println( "Employees processed polymorphically: " ); for ( Employee currentEmployee : employees ) { System.out.println( currentEmployee ); if ( currentEmployee instanceof BasePlusCommissionEmployee ) { BasePlusCommissionEmployee employee = ( BasePlusCommissionEmployee ) currentEmployee; double oldBaseSalary = employee.getBaseSalary(); employee.setBaseSalary( 1.10 * oldBaseSalary ); System.out.printf( "new base salary with 10%% increase is: $%,.2f ", employee.getBaseSalary() ); } System.out.printf( "earned $%,.2f ", currentEmployee.earnings() ); } for (int j = 0; j < employees.length; j++ ) System.out.printf( "Employee %d is a %s ", j, employees[ j ].getClass().getName()); } }

Explanation / Answer

The question is not clear. How ever it seems you want to take input for 5 arrays If so u can use this....... define... Scanner scan=new Scanner(System.in); and now you can take the input for each of the array and set the field of that array class using setters and getters. ex: System.out.println("enter the details of first array"); System.our.println("enter first name"); String firstName=scan.nextLine(); SalariedEmployee s=new SalariedEmployee (); s.setFirstName(firstName); .....you can do this for each field ....and then for each array you want to take input