Design Patterns: You are to provide a factory and implementation for three types of Employees. They are:
Question:
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() );
}