(Please use JAVA) Create custom exception and implement exception handling Create the following classes based on the UML Class diagram: - Employee - InvalidUserDetailException - EmployeeValidation-uses the custom InvalidUserDetailException class. This class contains an instancemethod validateInput() which will validate the employee details (name, age & gender) based on the specified criteria. * If employee details are within the criteria, employee details will be outputted in the console. * If employee details are not within the criteria, InvalidUserDetailException will be thrown with a message informing user that employee detail inputted is invalid. Create Employee Main class which will contain the main() method main() method will allow user to input employee name, age and gender. Calls validateInput() to validate the employee details.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 3PE
icon
Related questions
Question
(Please use JAVA) Create custom exception and implement exception handling Create the following classes based on the UML Class diagram: - Employee - InvalidUserDetailException - EmployeeValidation-uses the custom InvalidUserDetailException class. This class contains an instancemethod validateInput() which will validate the employee details (name, age & gender) based on the specified criteria. * If employee details are within the criteria, employee details will be outputted in the console. * If employee details are not within the criteria, InvalidUserDetailException will be thrown with a message informing user that employee detail inputted is invalid. Create Employee Main class which will contain the main() method main() method will allow user to input employee name, age and gender. Calls validateInput() to validate the employee details.
8
-name: String
age: int
gender: String
Employee
+ getName(): String
+ setName(name: String): void
+getAge(): int
+ setAge(age: int): void
+getGender(): String
+ setGender(gender: String): void
EmployeeValidation
+ validatelnput(emp: Employee): void
validatelnput(Emloyee) validates the employee details
based on the following criteria:
1) Name must not be less than 3 characters
2) Age must be between 18-65 years old
3) Gender must either be female or male (non-case
sensitive)
8
<<throws>>>
Exception
4
Extends
InvalidUserDetailException
--------▷-<<initialize>> serialVersionUID: long = 1L
+ InvalidUserDetailException(message: String)
Transcribed Image Text:8 -name: String age: int gender: String Employee + getName(): String + setName(name: String): void +getAge(): int + setAge(age: int): void +getGender(): String + setGender(gender: String): void EmployeeValidation + validatelnput(emp: Employee): void validatelnput(Emloyee) validates the employee details based on the following criteria: 1) Name must not be less than 3 characters 2) Age must be between 18-65 years old 3) Gender must either be female or male (non-case sensitive) 8 <<throws>>> Exception 4 Extends InvalidUserDetailException --------▷-<<initialize>> serialVersionUID: long = 1L + InvalidUserDetailException(message: String)
Sample Output: Invalid employee name.
*** Input Employee Details ***
Name: A
Age: 21
Gender: Female
Invalid Employee name A. Must be at least 3 characters.
Sample Output: Invalid employee age.
*** Input Employee Details ***
Name: John Doe
Age: 16
Gender: Male
Invalid Employee age. Must be between 18 - 65 years old.
Sample Output: Invalid employee gender.
*** Input Employee Details ***
Name: Jane Doe
Age: 24
Gender: femme
Invalid Employee gender. Only accepts either male or female.
Sample Output: Valid employee details.
*** Input Employee Details ***
Name: John Doe
Age: 21
Gender: Male
*** Employee Details ***
Name John Doe, Age=21, Gender-Male
Transcribed Image Text:Sample Output: Invalid employee name. *** Input Employee Details *** Name: A Age: 21 Gender: Female Invalid Employee name A. Must be at least 3 characters. Sample Output: Invalid employee age. *** Input Employee Details *** Name: John Doe Age: 16 Gender: Male Invalid Employee age. Must be between 18 - 65 years old. Sample Output: Invalid employee gender. *** Input Employee Details *** Name: Jane Doe Age: 24 Gender: femme Invalid Employee gender. Only accepts either male or female. Sample Output: Valid employee details. *** Input Employee Details *** Name: John Doe Age: 21 Gender: Male *** Employee Details *** Name John Doe, Age=21, Gender-Male
Expert Solution
steps

Step by step

Solved in 5 steps with 5 images

Blurred answer
Knowledge Booster
Algebraic Expressions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage