public final void setSsn(String ssn) {
        int j = 0;
        StringBuilder ssnWithoutDashes = new StringBuilder();

        if (ssn == null || ssn.length() < MIN_SSN_LENGTH || ssn.length() > MAX_SSN_LENGTH) {
            JOptionPane.showMessageDialog(null, SSN_ERROR_MESSAGGE);
        } else {
            String[] ssnParts = ssn.split("-");
            for (String ssnPart : ssnParts) {
                j += ssnPart.length();
            }
            if (j != MIN_SSN_LENGTH) {
                JOptionPane.showMessageDialog(null, SSN_ERROR_MESSAGGE);
            } else {
                for (String ssnPart : ssnParts) {
                    ssnWithoutDashes.append(ssnPart);
                }
                ssnWithoutDashes.toString();
                char[] ssnFinal = new char[MIN_SSN_LENGTH];
                for (int i = 0; i < ssnWithoutDashes.length(); i++) {
                    ssnFinal[i] = ssnWithoutDashes.charAt(i);
                }
                boolean isValid = false;
                for (int i = 0; i < ssnFinal.length; i++) {
                    if (Character.isDigit(ssnFinal[i])) {
                        isValid = true;
                    } else {
                        isValid = false;
                        JOptionPane.showMessageDialog(null, SSN_ERROR_MESSAGGE);
                        break;
                    }
                }
            }
        }
    }