import java.lancs.*; public class Ex4n3 { public static void main (String[] args) throws Exception { System.out.println (); Person person = new Person (); BasicIo.prompt ("type the forename: "); String forename = BasicIo.readString (); person.setForename (forename); System.out.println (); BasicIo.prompt ("type the surname: "); String surname = BasicIo.readString (); person.setSurname (surname); System.out.println (); BasicIo.prompt ("type the age: "); int age = BasicIo.readInteger (); if ((age < 1) || (age > Person.getUpperAgeLimit ())) { System.out.println ("invalid age " + age); System.exit (1); } person.setAge (age); System.out.println (); BasicIo.prompt ("type the gender (male, female): "); String gender_string = BasicIo.readString (); int gender = Person.UNKNOWN; if (gender_string.equalsIgnoreCase ("male")) { gender = Person.MALE; } else if (gender_string.equalsIgnoreCase ("female")) { gender = Person.FEMALE; } else { gender = Person.UNKNOWN; } person.setGender (gender); System.out.println (); System.out.println (); System.out.print ("The person you typed in is: "); print_person (person); } // end of main method public static void print_person (Person person) { System.out.print (person.getForename () + " ") ; System.out.print (person.getSurname () + " (") ; System.out.print (person.getAge () + ", ") ; System.out.println (person.getGenderString () + ")") ; } } // end of class Ex4n3