i need task 2# only i just added task 1# so u can see what to add
please follow the description and do as told thank you.
it's OOP2
the second pic isn't so clear so I added it here again
Lab 11: Exceptions and I/O Streams Lab Objectives - Be able to write code that handles an exception. - Be able to write code that throws an exception. - Be able to write a custom exception class. Introduction This program will ask the user for a person's name and social security number. The program will then check to see if the social security number is valid. An exception will be thrown if an invalid SSN is entered. You will be creating your own exception class in this program. You will also create a driver program that will use the exception class. Within the driver program, you will include a static method that throws the exception. Note: Since you are creating all the classes for this lab, there are no Student Files associated with this lab. Task \#1 Writing a Custom Exception Class 1. Create an exception class called SocSecException. The UML diagram for this class is below. The constructor will call the superclass constructor. It will set the message associated with the exception to "Invalid social security number" concatenated with the error string. 2. Create a driver program called SoeSecProcessor. This program will have a ma in method and a static method called isvalid that will check if the social security number is valid. Task \#2 Writing Code to Handle an Exception I. in the maith method a. The ins in method should read a name and social security number fram the arier as Steing objects. b. The main method should contain a tryecatch statement. This stantrest tries to check if the social security namber is valid by using the method i wal i ta if the social security mumber is valid, it prints the name and social seturity numbec. If a Fockeckxception is thrown, it should catch it and print out the name, social security number entered, and an associated error mensage indicating ahy the social secunty number is itsualid. e. loop should be used to allow the uner to continve unall the user indicats that thery do not want to continue. 2. The atatie IsVald method: a. This method throws a Socbectrocept ion. b. Returns true if the social security mumber is valid, tal se otherwise. c. The method checks for the following errors and throws a SocSecEuceptian with the appropriate menage. i. Number of characters not equal to 11 . fust check the lengith of the itrind ii. Dashes in the weont spots. ii. Any non-digits in the 55S. Mint: Uve a loop to step through each character of the strine checking fora dict or hrohen in the appropriate spots. 3. Compile, debug, and run yeur proyam. Sample output is strown below with user irout in bole. OUTPUT [boldface is user input) Lab 11: Exceptions and I/O Streams George Mahington 123455759 is valid Continue? X Narwe 7 Dodley Doright Saks 222-00-9930 Invalid the soclal security number, cobtalna o character that It not a digit Continue 7Y Hane? Jane Doe 887 333-333-333 Invalid thil saetal necurtty furber, dathes at, wrong posittent Continue 7n Task \#2 Writing Code to Handle an Exception 1. In the main method: a. The sia in method should read a name and social security number from the user as String objects. b. The main method should contain a tryncatch statement. This statement tries to check if the social security number is valid by using the method invalid. If the social security number is valid, it prints the name and social security number. If a SocSecException is thrown, it should catch it and print out the name, social security number entered, and an associated error message indicating why the social security number is invalid. c. loop should be used to allow the user to continue until the user indicates that they de not want to continue. 2. The statie iavalid method: a. This method throws a SocSeczxception. b. Returns true if the social security number is valid, fal se otherwise. c. The method checks for the following errors and throws a SocsecExcept ion with the appropriate message. i. Number of characters not equal to 11. (Just check the length of the string) ii. Dashes in the wrong spots. iii. Anv non-digits in the 55N. Hint: Use a loop to step through each character of the string, checking fora digit or hyphen in the appropriate spots. 3. Cempile, debug, and run your program. Sample output is shown below with user input in bold. OUTPUT (boldface is user input) Nane? sam s1y S5N? 333-00-999 Invalid the soelal aecurity number, wrong number of characters Continue? y Wame? George washington S5N? 123-45-6789 2 Lab 11: Exceptions and I/O Streams George Washington 123-45-6789 is valid Continue? Y Nane? Dudley Doright B6? 222-00-9990 Invalid the nocial security number, contains a character that is not a digit Continue? y Mamo? Jane Doe S5N? 333-333-333 Invalid the social aecurity number, daabes at wrong positions Continue? n