Question: Exercise 3: Complete the program below in order to make run properly by competing Phone Number methods and add try-catch block in the main method.
Exercise 3: Complete the program below in order to make run properly by competing Phone Number methods and add try-catch block in the main method. (Hint: phone number is a String of all numbers and its length is 9 or 10] public class ExceptionwithThrow public static String valid PhoneNum(String name) throws Input MismatchException // check here if the phone number is valid // throw InputMi smatchException it invalid // return the name if it is valid 1 public static void main(String args) // Ask the user to enter a phone number // check the phone validity through validPhoneNum method // Add try and catch block around appropriate statements
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
