Question
This is supposed to be in Java only. Suppose that you are required to write an application to model interns and supervisors in a company.
This is supposed to be in Java only.
Suppose that you are required to write an application to model interns and supervisors in a company.
1- Define an abstract superclass called Staff to store two properties as:
String name;
String address;
Provide (only one) constructor which sets the name and address properties.
Provide getters & setters and toString() methods for the class Staff.
2- Define:
Two subclasses of Staff, one named Intern and one Supervisor.
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
Intern() constructor calling the parent constructor
private instance variables: numTasks, taskList[], hourList[], MaxNumTasks=10
toString() method to describe itself. Add the string Intern: to the beginning.
addTaskHours(task, hours) adds a task and its hours. Validate that task description is not null and hours are greater than zero
// printHours() prints all Tasks taken and their hour
// 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
private instance variables: numTasks, taskList[], MaxNumTasks=5
Supervisor () constructor calling the parent constructor
toString() method to describe itself. Add the string Superviser: to the beginning.
addTask(task) adds a task to task list. Returns false if task already in the list.
removeTask (task) removes a task from task list. Returns false if task not found.
The program solution may only be uploaded in .jar format.
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started