I need to make a program and part of the program needs to get the users social security number and display it with the numbers being replaced by X. For example, if the user entered. 555-55-5555, it would show XXX-XX-XXXX instead. Also, I do not know how to make it so that it will only accept numbers. I don't want the user to be able to enter something like 55A-BC-55AB. I'm very lost here and would appreciate some help. What I have so far doesn't work. It has an error on the >= and the &&. That section is my attempt to make it only accept valid social security numbers.
I adjusted it to this and it somewhat solved the problem of accepting valid SSN's. At catches most errors anyways... but it still shows the initial user input as well as the ***-**-****
for example, the user enters 555-55-5555 the program will look like this to the user:
Social Security Number: 555-55-5555
Social Security Number: ***-**-****
So I need to make it so the first line doesn't appear. Here is the adjusted code