Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

COP 4814 Lab 6 (20 Points in total) Decorating Employee Objects (18 Points) Write a Java program that uses decorator classes to add capabilities to

COP 4814 Lab 6 (20 Points in total)

Decorating Employee Objects (18 Points)

Write a Java program that uses decorator classes to add capabilities to employees. In a typical company, an employee will be asked to perform a number of duties, such as Department Head, Safety Coordinator, Recruiter, or Community Liason. You should have additional ones besides those. Your Java program will create Employees and then decorate these employees at runtime.

Create an abstract class named Employee, with last name and description fields, and a getDescription() method. Create a concrete class named SalariedEmployee that extends Employee. Create an abstract class named ResponsibilityDecorator that is able to decorate an employee and return the employee's responsibility as a string. It will have an abstract getDescription method. Create some job category classes that extend the ResponsibilityDecorator class and implement the getDescription() method. Should they have constructors?

In your main test program, create at least 3 Employee objects and pass them to the constructors of each of your decorator classes. Then, print each Employee by calling its getDescription() method. The program's output should look something like this for each :

[LastName]: Manager, Recruiter, CommunityLiaison, ProductionDesigner Of course, you print the person's name where the "[LastName]" placeholder is shown.

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_2

Step: 3

blur-text-image_3

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

Focus On Geodatabases In ArcGIS Pro

Authors: David W. Allen

1st Edition

1589484452, 978-1589484450

More Books

Students also viewed these Databases questions

Question

Compare the current team to the ideal team.

Answered: 1 week ago

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago