Created
September 14, 2012 02:56
-
-
Save mueschm/3719548 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class SocialSecurities | |
{ | |
public static void main (String args []) | |
{ | |
String ssnum; | |
Scanner sc = new Scanner(System.in); | |
while(true) | |
{ | |
System.out.print("Please enter your Social Security number, type quit or stop to exit"); | |
ssnum = sc.nextLine(); | |
if (ssnum.equalsIgnoreCase("quit") || ssnum.equalsIgnoreCase("stop")) | |
break; | |
int ss; | |
char c; | |
ss = Integer.parseInt(ssnum); | |
for(int i = 0; i < ssnum.length();i++ ) | |
{ | |
c = ssnum.charAt(i); | |
if (! Character.isDigit(c)) | |
{ | |
System.err.println(""+c + "is not a digit"); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment