Question: Create a Test class that will ask the user to enter a mobile number of 8 - digits. If the phone number is not 8

Create a Test class that will ask the user to enter a mobile number of 8-digits. If the phone number is not 8 digits, it should throw an illegal argument exception that the entered mobile number is not eight digits, then ask the user to enter the phone number again until the user enters a valid 8 digits number. Your code should handle another type of exception that may occur. Dont write a general catch phrase with the super class Exception. Be specific with the exception type. Sample output Enter 8-digit phone Number 123 java.lang.IllegalArgumentException: Invalid phone number! Try again Enter 8-digit phone Number 99374421 Valid phone number

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 Programming Questions!