Description

5/5 - (2 votes)

Write a program to enter employee data into an ArrayList of type Employee. The data includes employee name, employee Social Security Number, employee job title, and employee salary. The maximum number of employees is 100, but your program should work for any number of employees less than 100. Your program should use two exception classes, one called SSNLengthException for Social Security number entered – without dashes or spaces – is not ex- actly nine characters and the other SSNCharacterException for when any character in the Social Security number is not a digit. When an Exception is thrown, the user should be reminded of of what he or she entered, told why it is inappropriate, and asked to reenter the data. After all data has been entered, your program should display the records for all employees, with an annotation stating whether the employee’s salary is above or below the average. You will also need to define the classes Employee, SSNLengthException, SSNCharacterException.

Derive the Employee class from the Person class. The Person class should have name and Social Security Number, the date hired as the instance variables.

The Employee class should have salary and position title as instance variables. If you want to add address, you need to define an Address class and include the Address object as instance variable in the Employee class. You need to include default and four or five parameter con- structor (two for name, and SSN and the rest for Employee class), getter or accessor methods, mutator or setter methods.

Every Employee record should record employee’s name, Social Security Number, address(optional), position title, salary, and hireDate.

In the EmployeeRecord class, you need to define a method that removes the hyphens from the Social Security number or uses Regex pattern to verify that there are correct number of digits. Another method to check that there is no character in place of a digit. So in the static main method of this class, use try – catch blocks to catch any Exceptions. The methods isValidLength() and isValidDigits() should both include throws clause in the header line.