Write a program to enter employee data, including social security number and salary, into an array. The maximum number of employees is 100, but your program should also work for any number of employees less than 100. Your program should use two exception classes, one called SSNLengthException for when the social security number entered—without dashes or spaces—is not exactly nine characters and the other called 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 what she or he 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
It may be useful to review arrays of objects before doing this project. For example, even after creating the array of EmployeeCh8 objects, it is necessary to create each element with a new statement inside the loop that reads in the employee’s information. Note that it is useful to use the same variable for the array subscript and the employee’s number, except that the subscript begins with 0 and the employee number begins with 1. So, whenever the employee number needs to be displayed, simply use the expression (subscript variable + 1).
See the code in EmployeeCh9.java, EmployeeCh9Demo.java, SSNLengthException.java, and SSNCharacterException.java. Uses Person.java.
You might also like to view...
Which statement about the memory functions of the string handling library is false?
a) The functions treat blocks of memory as strings. b) The functions facilitate manipulating, comparing and searching blocks of memory. c) The pointer parameters to these functions are defined void *. d) A void * pointer cannot be dereferenced.
How many levels of navigation should a Web site have?
a. As many as possible b. As many as necessary c. Three d. Four