Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(In Java) In Unit 10, you took an object-oriented approach towards creating employee classes that help the Human Resources (HR) department manage vacations and terminations

(In Java) In Unit 10, you took an object-oriented approach towards creating employee classes that help the Human Resources (HR) department manage vacations and terminations for your growing employee workforce

In this unit, you will expand upon object-oriented programming (OOP) concepts by completing a series of tasks designed to reinforce your understanding of OOP and class relationships. Your company project may also incorporate wrapper classes and automatic conversions to demonstrate competency with objects and arrays of objects if appropriate to your design.

Specification: Your company has now begun the process of expanding its workforce in four geographic locations, or branches, and requires a program to organize employee staffing. Doing so will help your companys HR department with managing each branch office and assist in determining whether the company needs to add more staff or move employees between locations.

Your program will expand on your employee program from the last unit, so be sure it is working correctly before beginning this one. Your program will organize employees for each branch location and add a manager for each branch.

Employee class **

You can use the employee class you created in Unit 10 and add new functionality to meet these requirements.

In addition to the current attributes, you will need to add

A four digit employeeID with setter and getter methods A static class variable to track total active employees The constructor method(s) for the employee class should also increment the class variable.

The terminate method for an employee should decrement the class variable

An appropriate getter should be coded for the static class variable to return total number of active employees.

Branch class

The Branch class needs to model the following attributes:

4-digit location ID location name branchID - a four-digit code to indicate location address A Manager object representing the supervisor an array of Employee objects representing the team The Branch class needs to model the following methods:

Default and parameterized constructors Getter and setter methods for the attributes addToTeam method that takes in an Employee object and adds it to the Team array removeFromTeam method that removes the Employee object from the Team displayBranchInfo method to display the supervisor and team information, as well as the number of employees on the team Manager class

The Manager class can be formatted similarly to the Employee class with the following attributes:

The managers First name The managers Last name The managers full name A 4-digit branch ID The Manager class needs to model the following methods:

default and parameterized constructors getter and setter methods Main method:

You may create your initial employees, managers, and locations programmatically or via user input.

Manager objects should be constructed with a default branchID of 9999 Branches should have supervisor and team attributes created but not initialized with values You will write a menu system that has two main functional areas:

Administration:

Select/enter a branch ID, retrieve the corresponding Branch object and offer these options:

Assign a manager to supervise the branch Assign an employee to the branch team Remove an employee from the branch team Reporting:

View a report of manager and employees for a specific lcoation View a cumulative report of all employees sorted by branch location, including total managers and total number of employees for the company The inputs required for testing your program are:

Data for three branch locations: 1000 Baltimore, 2000 Boston, and 3000 New York Data for 3-4 employees per branch. Therefore, you will have a total of 9 -12 employees across the 3 branches Data for at least 3 managers The data constructs, calculations and decisions required are:

At least three classes will need to be created. You may re-use and modify your Employee class from Unit 10. Be sure it is working correctly. You must demonstrate the ability to pass an array of Objects. You will need several arrays to hold your objects. When populating the branch team, you will iterate through the employee array and add the objects as selected to the branch team array. Be mindful to set the length correctly when initializing the team array. Intermediate data structures may be used, and passed into the branch team as an array of objects. When assigning a manager to the supervisor attribute in the branch object, be sure to update the branchID for the manager object, too. The outputs required are:

Menu and reports as described above A provision to inform the user of any exceptions (for example, You have entered an invalid branch ID) All other pertinent information, along with a UML diagram PDF, that continues the theme of your course portfolio

________________________________________________________________________________

**Employee class mentioned:

//import java.util.Scanner;

public class employee { //properties private String firstName; private String lastName; private String fullName; private date dateOfHire; private date terminationDate; private int unscheduledDays; private int scheduledDays; private String lastAnnualReview; //default constructor public employee() { firstName = ""; lastName = ""; fullName= firstName + " " + lastName; unscheduledDays = 0; scheduledDays = 0; lastAnnualReview = ""; dateOfHire = new date(); terminationDate = new date(); } //parameterized constructor public employee(String firstName, String lastName, int mm, int dd, int yy) { this.firstName = firstName; this.lastName = lastName; this.fullName = firstName + " " + lastName; this.unscheduledDays = 0; this.scheduledDays = 0; this.lastAnnualReview = ""; //dates dateOfHire = new date(); dateOfHire.setDate(mm, dd, yy); terminationDate = new date(); } // getter methods public String getFirstName() { return firstName; } public String getLastName() { return lastName; } public String getFullName() { return fullName; } public date getDateOfHire() { return dateOfHire; } public date getTerminationDate() { return terminationDate; } public int getUnscheduledDays() { return unscheduledDays; } public int getScheduledDays() { return scheduledDays; } public String getLastAnnualReview() { return lastAnnualReview; } // setter methods public void setFirstName(String firstName) { this.firstName = firstName; } public void setLastName(String lastName) { this.lastName = lastName; } public void setFullName(String fullName) { this.fullName = fullName; } public void setDateOfHire(int mm, int dd, int yy) { this.dateOfHire.setDate(mm, dd, yy); } public void setTerminationDate(int mm, int dd, int yy) { this.terminationDate.setDate(mm, dd, yy); } public void setUnscheduledDays(int unscheduledDays) { this.unscheduledDays = unscheduledDays; } public void setScheduledDays(int scheduledDays) { this.scheduledDays = scheduledDays; } public void setLastAnnualReview(String lastAnnualReview) { this.lastAnnualReview = lastAnnualReview; } // other methods public void scheduleVacationDay() { if(unscheduledDays > 0) unscheduledDays--; // lose a day from what they have left scheduledDays++; // gain a day to the number they have scheduled } public void cancelVacationDay() { unscheduledDays++; // gain a day from what they have left if(scheduledDays > 0) scheduledDays--; // lose a day to the number they have scheduled } public void terminateEmployee(int mm, int dd, int yy) { terminationDate.setDate(mm, dd, yy); // get a termination date value } public String toString() { return " Name: " + fullName + " Date of hire: " + dateOfHire.getDate() + " Termination date: " + terminationDate.getDate() + " Unscheduled Days: " + unscheduledDays + " Scheduled Days: " + scheduledDays + " Last Annual Review: " + lastAnnualReview; } }

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

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions

Question

Explain the seven dimensions of an organizations climate.

Answered: 1 week ago

Question

Describe the five types of change.

Answered: 1 week ago