Question: Create a new package named program in Eclipse (the project name can be 112 or whatever you have), and put the class in this package

 Create a new package named program in Eclipse (the project name

Create a new package named program in Eclipse (the project name can be 112 or whatever you have), and put the class in this package (right-click on a project New Package, type program6 as the package name). Write a program that prompts the user to enter a social Security number in the format DDD-DD-DDDD, where D is a digit. Your program should check whether the input is valid. (The valid format is 3 digits, followed by a hyphen, then 2 digits, another hyphen, followed by 4 digits.) This program contains a user-defined static method and a main method. In the user-defined method, accept an SSN as a String and determine whether it is valid or not based on the above criteria. The method header looks like this: public static boolean isValid (String ssn) In the main method, ask the user to enter an SSN, continue to ask for an SSN until it is a valid one (call the isValid method to determine whether it is valid, use a loop here). Check the sample output below. You can name your program SSNVerifier.java Sample Output Enter a Social Security number: 23-23-1234 Your SSN "23-23-1234" is not valid! The SSN should follow the format DDD-DD-DDDD Please enter your SSN again: 23-123-1234 Your SSN "23-123-1234" is not valid! The SSN should follow the format DDD-DD-DDDD Please enter your SSN again: 123-23-1234 Congratulations! Your SSN "123-23-1234" is valid

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!