Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Develop a Java application which performs workers evaluation by checking whether or not employees have met the requirements to receive a weekly reward bonus. To

Develop a Java application which performs workers evaluation by checking whether or not employees have met the requirements to receive a weekly reward bonus.

To get a weekly reward bonus from ABC Company, all employees both full time and part time need to complete a minimum of 2 tasks per week. In addition, full time employees must complete 20 hours of group service, and part time employees must serve two groups.

Your project should have an Employee class which should be extended by the classes FullTimeEmployees and PartTimeEmployees. Your project will also include the EvaluationAuditor class, which is used to audit a list of employees and determine whether each employee has qualified for the weekly reward bonus.

The Employee class should implement the IAuditable interface which is given below:

public interface IAuditable {

/**

* This method determines whether or not an employee qualifies for a weekly bonus.

* This is general for an employee object but is more specific for a part time or a full time

* employee (see specific details in LA documentation).

*

* @return True if employee has met requirements to get the reward; false otherwise.

*/

boolean meetsRequirements();

/**

* This updates the number of tasks completed for this employee and prints out

* a message indicating the employee name, tasks performed.

*

* @param taskName Title of task performed by employee

*/

void takeTask(String taskName);

/**

* Returns number of tasks completed by employees.

*

* @return number of tasks completed

*/

int getTasksCompleted();

/**

* Returns employee ID.

*

* @return employee ID

*/

int getEmployeeID();

/**

* Returns first name.

*

* @return first name

*/

String getFirstName();

/**

* Returns last name.

*

* @return last name

*/

String getLastName();

/**

* Returns gender.

*

* @return gender

*/

String getGender();

/**

* Returns age.

*

* @return age

*/

int getAge();

}

As mentioned earlier, the classes FullTimeEmployee and PartTimeEmployee should extend the Employee class.

Consider: will these subclasses need to override any of the methods in the Employee class? If so, which method(s) will be overridden and why is this necessary?

The FullTimeEmployee class should include the method below.

/**

* Updates the number of group service hours completed by employee

* and prints out a message with the employee's first and last name and

* hours of group service.

*

* @param hours number of hours of group service.

*/

public void doComunityService(int hours);

The PartTimeStudent class should also include the method below:

/**

* Stores the title of the groups in the String array attribute,

* increments the number of groups and prints out a message with

* the employee's name and the group served.

*

* @param title title of group

*/

public void servedGroup(String title);

The EvaluationAuditor class implements the IEvaluationAuditor interface. This class has a very simple job it receives an array of objects, determines if each object meets the evaluation requirements (i.e. it audits each object in the array), and prints out a corresponding message. Not just any object can be audited, however. Any object passed to the audit method in the EvaluationAuditor class must belong to a class that implements the IAuditable interface.

The IEvaluationAuditor interface is given below:

public interface IEvaluationAuditor {

/**

* This method uses the meetsRequirements() method to determine if each of the

* Employee objects in the array has met the requirements for weekly reward bonus. It prints

* out a message about whether or not each specific employee can be rewarded depending

* on the value returned by meetsRequirements().

*

* @param employees An array of objects of the IAuditable interface who are to be

* audited to determine if they qualify to get the reward bonus.

*/

void audit(IAuditable[] employees);

}

You will also need a main class with which you can test your classes. Create a test class named LA3Main with a main method. Copy and paste the code in the main method below into your main method to test your program. Do NOT make any changes to this code.

public static void main(String[] args) {

// TODO Auto-generated method stub

Auditor auditor = new Auditor();

System.out.println(" Full time employees:");

System.out.println("======================= ");

FullTimeEmployee[] fullTime = new FullTimeEmployee[2];

// Employee #1

fullTime[0] = new FullTimeEmployee("Blanche Graves", 111, 23, "female");

System.out.println(fullTime[0].getName());

System.out.println("==============");

fullTime[0].doGroupService(20);

fullTime[0].doGroupService(20);

fullTime[0].takeTask("Intro to Java");

fullTime[0].takeTask("Intro to Computing");

fullTime[0].printData();

System.out.println();

// Employee #2

fullTime[1] = new FullTimeEmployee("Morris Patton", 222,45, "male");

System.out.println(fullTime[1].getName());

System.out.println("==============");

fullTime[1].doGroupService(15);

fullTime[1].takeTask("Intro to Java");

fullTime[1].takeTask("Intro to Computing");

fullTime[1].printData();

System.out.println(" Part-Time employees");

System.out.println("================== ");

PartTimeEmployee[] partTime = new PartTimeEmployee[2];

// Employee #3

partTime[0] = new PartTimeEmployee("Bloke Bennett", 111, 64, "male");

System.out.println(partTime[0].getName());

System.out.println("==============");

partTime[0].servedGroup("The Meaning of Life");

partTime[0].servedGroup("Living Free");

partTime[0].takeTask("Intro to Java");

partTime[0].takeTask("Intro to Computing");

partTime[0].printData();

System.out.println();

// Employee #4

partTime[1] = new PartTimeEmployee("Lissie Copperfield", 222,34,"female");

System.out.println(partTime[1].getName());

System.out.println("==============");

partTime[1].servedGroup("The Meaning of Life");

partTime[1].takeTask("Intro to Java");

partTime[1].takeTask("Intro to Computing");

partTime[1].printData();

System.out.println(" Audit results:");

System.out.println("============== ");

auditor.audit(fullTime);

auditor.audit(partTime);

}

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

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

More Books

Students also viewed these Databases questions