I need help with my constructor that should call for all the user inputs, for example their first name, and the information gets checked to make sure it's valid. For example the name is all letters, and the identifier is actually 9 digits, etc. I can set the default constructor, but then the input from the user doesn't get checked. There's that issue and then the issue with writing to the file. It throws one of my exceptions saying error writing to file and that is from the last line I wrote with writeObject().
public static void addRecords()
{
try
{
Customer record = new Customer() ;
System.out.println( "Please enter customer number (must be greater than 1000):" );
int custNbr = scanner.nextInt();
scanner.nextLine();
System.out.println( "Please enter tax identifier (must be 9 digits):" );
String taxID = scanner.nextLine();
System.out.println( "Please enter first name:" );
String firstName = scanner.nextLine();
System.out.println( "Please enter last name:" );
String lastName = scanner.nextLine();
System.out.println( "Please enter code for title: " );
System.out.println( "1 = Mr., 2 = Ms., 3 = Mrs., 4 = Miss, 5 = Dr., 99 = none");
int custHonor = scanner.nextInt();
scanner.nextLine();
newFile.writeObject(record);
}