public class SocialSecurityNumber
extends java.lang.Object
implements java.lang.Comparable
Note: A social security number is a nine-digit number broken into three groups in the form XXX-XX-XXXX. The first three digits (the "area") are between 001 and 799 (inclusive). The next two digits (the "group") are between 01 and 99 (inclusive). The last four digits (the "serial") are between 0001 and 9999 (inclusive).
Constructor and Description |
---|
SocialSecurityNumber(int n)
Construct a SocialSecurityNumber from a specified number.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(java.lang.Object o)
Compare this SocialSecurityNumber to another.
|
void |
set(int n)
Set the value of this SocialSecurityNumber.
|
java.lang.String |
toString()
Return the value of this Social Security Number as a String.
|
public SocialSecurityNumber(int n)
n
- the social security number as an integerpublic int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
o
- the other SocialSecurityNumber to compare to.java.lang.ClassCastException
- Indicates that o is not a SocialSecurityNumber.public void set(int n)
n
- the social security number as an integerpublic java.lang.String toString()
toString
in class java.lang.Object