Question: You should write the following methods to complete this task: main method Ask the user to enter her/his ID [String] and birth year (int). Call

 You should write the following methods to complete this task: mainmethod Ask the user to enter her/his ID [String] and birth year

You should write the following methods to complete this task: main method Ask the user to enter her/his ID [String] and birth year (int). Call the method check and print a massage based on the returned value: o true => print You are qualified to enter the training course" o false >> print You are not qualified to enter the training course" Handle any exceptions might occur in your code and print the Exception in the catch block check method The method receives two parameters: the Das String and the birth year as integer, and returns Boolean value. If ID length is 10 characters, calculate the age using the birth year value (age = 2021- birthyear) and return : o true if the calculated age greater or equal 18 o false if the age less than 18. If ID length is not 10 character throw an Exception with the message: DD should be 10 characters. NOTES o Make sure that all exceptions are handled in the main method. Additional exceptions may occur during the test of this program. Thus, make sure that your code can avoid any other exception going uncaught. Sample Run 1: Qualified run: Enter your id: 1034864477 Enter your birth year: 2001 You are qualified to enter the training course BUILD SUCCESSFUL (total time: 18 seconds) Sample Run 2: Not qualified run: Enter your id: 1032354231 Enter your birth year: 2009 You are not qualified to enter the training course BUILD SUCCESSFUL (total time: 12 seconds) Sample Run 3: Exception D run: Enter your id: 2344231 Enter your birth year: 2000 java.lang. Exception: ID should be 10 characters BUILD SUCCESSFUL (total time: 8 seconds) Sample Run 4: Other Exception run: Enter your id: 2012432321 Enter your birth year: two java.util. InputMismatchException BUILD SUCCESSFUL (total time: 26 seconds)

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!