Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose that you are required to write an application in JAVA to model interns and supervisors in a company. 1- Define an abstract superclass called

Suppose that you are required to write an application in JAVA to model interns and supervisors in a company.

1- Define an abstract superclass called Staff to store two properties as:

String name;

String address;

[4 points] Provide (only one) constructor which sets the name and address properties.

[6 points] Provide getters & setters and toString() methods for the class Staff.

2- Define:

[2 points] Two subclasses of Staff, one named Intern and one Supervisor.

[3 points] Both classes, Intern and Supervisor must implement the interface StaffInfo, provided below.

3- Requirements for the class Intern:

should maintain a list of tasks taken and the respective hours for each task.

an intern cannot have more than 10 tasks

should also provide a method to add a task with hours

print all tasks taken with task description and hours

calculate the average hours of the tasks assigned

[5 points] Intern() constructor calling the parent constructor

[5 points] private instance variables: numTasks, taskList[], hourList[], MaxNumTasks=10

[5 points] toString() method to describe itself. Add the string Intern: to the beginning.

[5 points] addTaskHours(task, hours) adds a task and its hours. Validate that task description is not null and hours are greater than zero

[5 points] // printHours() prints all Tasks taken and their hour

[5 points] // getAverageHour() computes the average hour

4- Requirements for the class Supervisor:

should maintain a list of tasks they currently supervise

be able to add or remove a task supervised

assume that a supervisor cannot supervise more than 5 tasks

[5 points] private instance variables: numTasks, taskList[], MaxNumTasks=5

[5 points] Supervisor () constructor calling the parent constructor

[5 points] toString() method to describe itself. Add the string Superviser: to the beginning.

[5 points] addTask(task) adds a task to task list. Returns false if task already in the list.

[5 points] removeTask (task) removes a task from task list. Returns false if task not found.

Note: Your program solution may only be uploaded in .jar format. No other format will be graded.

Interface to be implemented by the Intern & the Supervisor class as described in item 2 above.

/**************************************************

* StaffInfo interface declaration.

**************************************************/

public interface StaffInfo {

// Returns (String Supervisor or Intern), name + address of the staff

String getStaffInfo();

}

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

The World Wide Web And Databases International Workshop Webdb 98 Valencia Spain March 27 28 1998 Selected Papers Lncs 1590

Authors: Paolo Atzeni ,Alberto Mendelzon ,Giansalvatore Mecca

1st Edition

3540658904, 978-3540658900

More Books

Students also viewed these Databases questions

Question

Describe the importance of self-confidence and self-efficacy.

Answered: 1 week ago