Question: Design Patterns: You are to provide a factory and implementation for three types of Employees. They are: Captain, Pilot, and Crewman. Your completed code should

Design Patterns:

You are to provide a factory and implementation for three types of Employees. They are: Captain, Pilot, and Crewman. Your completed code should pass the test case given at the end of this assignment. For more information on the Factory Design Pattern, please see the course PowerPoint or the following link: https://www.tutorialspoint.com/design_pattern/factory_pattern.htm

Test Code to base it off of:

@Test void testFactory() { EmployeeFactory employeeFactory = new EmployeeFactory();

// Create Captain Reggie and set their time to 5 hours Employee reggie = employeeFactory.getEmployee("captain"); reggie.setHours(5); // Create Pilot Karen and set their time to 12 hours Employee karen = employeeFactory.getEmployee("pilot"); karen.setHours(12); // Create Crewman John and set their time to hours Employee john = employeeFactory.getEmployee("crewman"); john.setHours(8); // You'll need to determine pay rate. assertEquals( 100, reggie.getPay() ); assertEquals( 288, karen.getPay() ); assertEquals( 96, john.getPay() );

}

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 Programming Questions!