Question: 4. Create an EmployeeException class whose constructor receives employee's identification and an age. Save the file as EmployeeException.java. Create an Employee class with two fields,

 4. Create an EmployeeException class whose constructor receives employee's identification and

4. Create an EmployeeException class whose constructor receives employee's identification and an age. Save the file as EmployeeException.java. Create an Employee class with two fields, idNum and age. The Employee constructor requires values for both fields. Write an exception statement that will validate identification number and age entered by user. User might make the following errors as they enter the data: . If identification number entered by the user less than 0 or greater than 999, throw NumberFormatException() and display message "ldentification out of range!" If a user enter negative value for identification or age, throw llegalArgumentException() and display message "Age or ID cannot be negative!". If a user enter identification number and age other than integer value, throw InputMismatchException) statement and display message "Age must integer value" At the end of your code segment, write finally statement to display a message "Done!" Write an application that can manipulate all the error might be

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!