Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro Android Graphics

Authors: Wallace Jackson

1st Edition

1430257857, 978-1430257851

More Books

Students also viewed these Programming questions