Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Java by shuggins ( 6 years ago )
/**
* This program validates.
*
* @shuggins (your name)
*/
import java.util.Scanner;
public class SSN
{
public static void main(String [] args)
{
Scanner in = new Scanner(System.in);
System.out.println("Please input your SSN and I will let you know if it is valid.");
String sSN=in.nextLine();
String h1=sSN.substring(3,4);
String h2=sSN.substring(6,7);
if(sSN.length()==11)
{
if(h1.indexOf("-")==0)
{
System.out.println("Valid");
}
else
{
System.out.println("Not Valid");
}
}
else
{
System.out.println("Not Valid");
}
}
}
Revise this Paste