Question: Design a program which takes a 9 digit string and formats it in Social Security Number Format. ( XXX - XX - XXXX ) Your

Design a program which takes a 9 digit string and formats it in Social Security Number Format. (XXX-XX-XXXX)
Your program must take the input as a string or you will receive a 0 on this assignment.
Example:
On the input "155781673" your program should output something like "Social Security Number: 155-78-1673"
On the input "067846611" your program should output something like "Social Security Number: 067-84-6611"
Edge Cases:
Your program should not accept social security numbers of lengths other that 9
Your program should not accept social security number which contain non-numeric characters
Edge Case Examples:
On the input "90878" your program should output something like "Length Error: Social Security Numbers must contain 9 numbers"
On the input "fyc3DtkLe" your program should output something like "Character Error: Social Security Numbers must be all numeric."
Do not use an input validation loop;end the program after printing your error message.
Helpful String Methods
length
insert
substr
Consider testing some or all of the values outlined.

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!