Answered step by step
Verified Expert Solution
Question
1 Approved Answer
java in BlueJ and set up application as shown in figure 1 only use Java not less knowledge all info is provided Overview: An object-oriented
java in BlueJ and set up application as shown in figure 1
only use Java
not less knowledge
all info is provided
Overview: An object-oriented application is required for a human resource system that manages employees. The application provides a simple user interface that allows a user to perform the following operations: 1. Add a new employee to the system 2. Display a list of all employees managed by the system 3. Terminate an employee record 4. Record salary data for an employee 5. Display salary and NIS for an employee 6. Submit a salary sheet for an employee The application consists of three domain classes: HRApplication, Employee, and Salary Sheet. The user interface of the application will be provided by another class called HRConsole. UML Diagram of Domain Classes Figure 1 shows a simplified UML diagram of the HR Console, HRApplication, Employee, and Salary Sheet, classes. An Employee object is related to many Salary Sheet objects. An HRApplication object manages many Employee objects. The HR Console class invokes the services of the HRApplication class. HRConsole HRApplication Salary Sheet Figure 1: UML Diagram of Domain Classes SalarySheet Class The Salary Sheet class models an employee's salary sheet for a specific month in 2019. Weeks are counted based on the number of Saturdays in the month. For instance February 2019 has 4 Saturdays which means there should be 4 salary data entries in the salary sheet. March 2019 has 5 Saturdays which means 4 salary data entries are expected and so on. Attribute Type month int salaries double[] Purpose The month for which salary and nis data are stored. January = 1, February = 2 ... December = 12 Stores the each of the weekly salaries of an employee for the month. This array's size is determined by the number of Saturdays in the month. Stores the nis dues for the employee for each week of the month. This should be same size as the salaries array. Indicates whether the salary sheet has been submitted and therefore salaries cannot be altered. Default: false nisDues double[ ] submitted boolean Return Type Purpose Method Signature Salary Sheet(int month) addSalary(int weekNumber, double amount) String calculateNisDues() void Constructor Adds or updates the salary stored for a particular week in the month. Returns "Salary added" if successful, or one of the following error messages as appropriate: "Cannot update salary: Salary sheet submitted." "Invalid week for month" A private method that is called every time the salary data is updated. This calculation is based on the scale below. Sets the submitted attribute to true. Returns the employee's total monthly salary before nis deductions Returns the total nis dues for the month Returns a String representation of the Salary Sheet void submitSheet({ getTotalSalary() double getNISDues() double toString() String The SalarySheet class has the methods above. Note: Accessors and mutators (as appropriate) for the Salary Sheet attributes are required using the naming convention followed by Java developers. NIS Dues Example Calculation: December 2019 Weekly Earnings Employee's Weekly Contribution NIS dues are calculated using the table to the right If no salary data is entered for a given week, then there are no nis dues for that employee for that week 200.00 - 339.99 11.90 340.00 - 449.99 450.00 - 609.99 610.00 - 759.99 December 2019 Week 1 Week 2 Week 3 Week 4 Salary 834.00 1000.00 667.00 834.00 NIS | 37.20 45.10 30.10 37.20 Total 3335.00 149.60 760.00 - 929.99 930.00 -1,119.99 1,120.00 -1,299.99 The table above shows the expected output for the toString() method of the Salary Sheet class. 1,300.00 -1,489.99 61.40 1,490.00 -1,709.99 1,710.00 -1,909.99 1,910.00 -2,139.99 2,140.00 -2,379.99 99.40 2,380.00 -2,629.99 110.20 2,630.00 -2,919.99 122.10 2,920.00 -3,137.99 133.30 3,138.00.00 and over 138.10 Employee Class The Employee class models an employee with the following attributes: Attribute Type Purpose NISNumber int The employee's NIS number (unique) The employee's full name name String startDate Date endDate The date the employee started working The date the employee stopped working The employee's date of birth An array that stores all of the Salary Sheet objects for 2019 for an Employee Date Date SalarySheet[] dateOfBirth salary Sheet The Employee class has the following methods: String Method Signature Return Type Purpose Employee (String name, Date DOB, int NISNumber, Constructor Date startDate) Updates the employee's salary for a specific week in a particular month. This method returns messages from the Salary Sheet class if successful, or one of recordSalary(int month, int week, the following error messages as double amount) appropriate: "Cannot record salary: Invalid month" "Cannot record salary: Employee terminated" Returns the salary sheet representation for the month or one of the following error getSalaryAndNISRecord(int messages as appropriate: month) String . "Invalid month" "No records entered for month This method submits the salary sheet for the given month and returns "Sheet submitted for month" if successful, or one submitSalary Sheet(int month) of the following error messages as appropriate: "No records entered for month "Invalid month Returns a String representation of the toString() String Employee containing aggregated demographic state (no salary data) Note: Accessors and mutators for the Employee attributes should be provided as appropriate. In addition, helper methods (private) are advised to reduce the complexity of your methods if applicable. String HRApplication Class The HRApplication class models the following attributes: Attribute Type Purpose A collection that holds all of the Employee objects managed by the system. A maximum of 20 Rooms can employees Employee be managed in the first case. This should be extended by twice the existing length when filled. The number of employees currently managed in the numEmployees int system An immutable, class variable that stores the date datePattern String pattern used in the program "dd/MM/yyyy" The HRApplication has the following methods: Method Signature Return Type Purpose HRApplication() addEmployee(String name, String DOB, String NISNumber, String startDate) String getEmployeeList() String terminate EmployeeRecord(String NISNumber, String endDate) String Constructor Adds a new Employee to the system and returns the following messages "Employee added": if successful or the following for the appropriate cases: "DOB not formatted correctly" "Start date not formatted correctly" "NIS number should have 8 numbers" "Employee already exists Returns a list of all of the employees managed by the system if any, or otherwise the message "No employees in the system." is returned Terminates an employee by setting the end date value and returns "Employee record terminated successfully if successful, otherwise returns one of the following messages as appropriate: "End date not formatted properly "Invalid NIS number. Employee Not Found." Adds or updates a specific salary entry for an employee and returns the results passed from the Employee object if successful, otherwise "Invalid NIS number. Employee Not Found." Returns the monthly details of the salary and nis for an employee with a given nis number if found in the system,otherwise the messages are returned as appropriate: "Invalid month" "No records entered for month" . "Invalid NIS number. Employee Not Found." recordSalary(String NISNumber, int month, int week, double amount String getSalaryAndNISRecord(String NISNumber, int month) String Method Signature Return Type submitSalary Sheet(String NISNumber, int month) String Purpose Submits the given employee's salary sheet if found and returns the messages generated by the Employee class, otherwise "Invalid NIS number. Employee Not Found." Returns an employee object with the given NIS number if found, null otherwise findEmployee(String NISNumber) Employee HRConsole: User Interface and Main Class The user interface must enable the user to perform several operations: 1. Add a new employee to the system 2. Display a list of all employees managed by the system 3. Terminate an employee record 4. Record salary data for an employee 5. Display salary and NIS for an employee 6. Submit a salary sheet for an employee The user interface should accept input from the keyboard and generate textual output to the console. The HRConsole class should provide the functionality of the user interface. You should note that the user interface must create an instance of the HRApplication class before doing anything else. After it receives user input, it forwards requests to the domain classes to accomplish the tasks required. The results are received and displayed on the console. Appropriate error checking is required! Dates All dates should be formatted according to the pattern dd/MM/yyyy. Refer to the Java API for the appropriate classes that can be used to achieve this. Overview: An object-oriented application is required for a human resource system that manages employees. The application provides a simple user interface that allows a user to perform the following operations: 1. Add a new employee to the system 2. Display a list of all employees managed by the system 3. Terminate an employee record 4. Record salary data for an employee 5. Display salary and NIS for an employee 6. Submit a salary sheet for an employee The application consists of three domain classes: HRApplication, Employee, and Salary Sheet. The user interface of the application will be provided by another class called HRConsole. UML Diagram of Domain Classes Figure 1 shows a simplified UML diagram of the HR Console, HRApplication, Employee, and Salary Sheet, classes. An Employee object is related to many Salary Sheet objects. An HRApplication object manages many Employee objects. The HR Console class invokes the services of the HRApplication class. HRConsole HRApplication Salary Sheet Figure 1: UML Diagram of Domain Classes SalarySheet Class The Salary Sheet class models an employee's salary sheet for a specific month in 2019. Weeks are counted based on the number of Saturdays in the month. For instance February 2019 has 4 Saturdays which means there should be 4 salary data entries in the salary sheet. March 2019 has 5 Saturdays which means 4 salary data entries are expected and so on. Attribute Type month int salaries double[] Purpose The month for which salary and nis data are stored. January = 1, February = 2 ... December = 12 Stores the each of the weekly salaries of an employee for the month. This array's size is determined by the number of Saturdays in the month. Stores the nis dues for the employee for each week of the month. This should be same size as the salaries array. Indicates whether the salary sheet has been submitted and therefore salaries cannot be altered. Default: false nisDues double[ ] submitted boolean Return Type Purpose Method Signature Salary Sheet(int month) addSalary(int weekNumber, double amount) String calculateNisDues() void Constructor Adds or updates the salary stored for a particular week in the month. Returns "Salary added" if successful, or one of the following error messages as appropriate: "Cannot update salary: Salary sheet submitted." "Invalid week for month" A private method that is called every time the salary data is updated. This calculation is based on the scale below. Sets the submitted attribute to true. Returns the employee's total monthly salary before nis deductions Returns the total nis dues for the month Returns a String representation of the Salary Sheet void submitSheet({ getTotalSalary() double getNISDues() double toString() String The SalarySheet class has the methods above. Note: Accessors and mutators (as appropriate) for the Salary Sheet attributes are required using the naming convention followed by Java developers. NIS Dues Example Calculation: December 2019 Weekly Earnings Employee's Weekly Contribution NIS dues are calculated using the table to the right If no salary data is entered for a given week, then there are no nis dues for that employee for that week 200.00 - 339.99 11.90 340.00 - 449.99 450.00 - 609.99 610.00 - 759.99 December 2019 Week 1 Week 2 Week 3 Week 4 Salary 834.00 1000.00 667.00 834.00 NIS | 37.20 45.10 30.10 37.20 Total 3335.00 149.60 760.00 - 929.99 930.00 -1,119.99 1,120.00 -1,299.99 The table above shows the expected output for the toString() method of the Salary Sheet class. 1,300.00 -1,489.99 61.40 1,490.00 -1,709.99 1,710.00 -1,909.99 1,910.00 -2,139.99 2,140.00 -2,379.99 99.40 2,380.00 -2,629.99 110.20 2,630.00 -2,919.99 122.10 2,920.00 -3,137.99 133.30 3,138.00.00 and over 138.10 Employee Class The Employee class models an employee with the following attributes: Attribute Type Purpose NISNumber int The employee's NIS number (unique) The employee's full name name String startDate Date endDate The date the employee started working The date the employee stopped working The employee's date of birth An array that stores all of the Salary Sheet objects for 2019 for an Employee Date Date SalarySheet[] dateOfBirth salary Sheet The Employee class has the following methods: String Method Signature Return Type Purpose Employee (String name, Date DOB, int NISNumber, Constructor Date startDate) Updates the employee's salary for a specific week in a particular month. This method returns messages from the Salary Sheet class if successful, or one of recordSalary(int month, int week, the following error messages as double amount) appropriate: "Cannot record salary: Invalid month" "Cannot record salary: Employee terminated" Returns the salary sheet representation for the month or one of the following error getSalaryAndNISRecord(int messages as appropriate: month) String . "Invalid month" "No records entered for month This method submits the salary sheet for the given month and returns "Sheet submitted for month" if successful, or one submitSalary Sheet(int month) of the following error messages as appropriate: "No records entered for month "Invalid month Returns a String representation of the toString() String Employee containing aggregated demographic state (no salary data) Note: Accessors and mutators for the Employee attributes should be provided as appropriate. In addition, helper methods (private) are advised to reduce the complexity of your methods if applicable. String HRApplication Class The HRApplication class models the following attributes: Attribute Type Purpose A collection that holds all of the Employee objects managed by the system. A maximum of 20 Rooms can employees Employee be managed in the first case. This should be extended by twice the existing length when filled. The number of employees currently managed in the numEmployees int system An immutable, class variable that stores the date datePattern String pattern used in the program "dd/MM/yyyy" The HRApplication has the following methods: Method Signature Return Type Purpose HRApplication() addEmployee(String name, String DOB, String NISNumber, String startDate) String getEmployeeList() String terminate EmployeeRecord(String NISNumber, String endDate) String Constructor Adds a new Employee to the system and returns the following messages "Employee added": if successful or the following for the appropriate cases: "DOB not formatted correctly" "Start date not formatted correctly" "NIS number should have 8 numbers" "Employee already exists Returns a list of all of the employees managed by the system if any, or otherwise the message "No employees in the system." is returned Terminates an employee by setting the end date value and returns "Employee record terminated successfully if successful, otherwise returns one of the following messages as appropriate: "End date not formatted properly "Invalid NIS number. Employee Not Found." Adds or updates a specific salary entry for an employee and returns the results passed from the Employee object if successful, otherwise "Invalid NIS number. Employee Not Found." Returns the monthly details of the salary and nis for an employee with a given nis number if found in the system,otherwise the messages are returned as appropriate: "Invalid month" "No records entered for month" . "Invalid NIS number. Employee Not Found." recordSalary(String NISNumber, int month, int week, double amount String getSalaryAndNISRecord(String NISNumber, int month) String Method Signature Return Type submitSalary Sheet(String NISNumber, int month) String Purpose Submits the given employee's salary sheet if found and returns the messages generated by the Employee class, otherwise "Invalid NIS number. Employee Not Found." Returns an employee object with the given NIS number if found, null otherwise findEmployee(String NISNumber) Employee HRConsole: User Interface and Main Class The user interface must enable the user to perform several operations: 1. Add a new employee to the system 2. Display a list of all employees managed by the system 3. Terminate an employee record 4. Record salary data for an employee 5. Display salary and NIS for an employee 6. Submit a salary sheet for an employee The user interface should accept input from the keyboard and generate textual output to the console. The HRConsole class should provide the functionality of the user interface. You should note that the user interface must create an instance of the HRApplication class before doing anything else. After it receives user input, it forwards requests to the domain classes to accomplish the tasks required. The results are received and displayed on the console. Appropriate error checking is required! Dates All dates should be formatted according to the pattern dd/MM/yyyy. Refer to the Java API for the appropriate classes that can be used to achieve this 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