import java.lancs.BasicIo; class Person { private String name; private int age; private static final int UPPER_AGE_LIMIT = 125; public Person () { name = "NONE"; age = 0; } public Person (String n, int a) { name = n; age = a; } public String getName () { return name; } public void setName (String n) { name = n; } public int getAge () { return age; } public boolean setAge (int a) { if (a < 0 || a > UPPER_AGE_LIMIT) { return false; } else { age = a; return true; } } } public class Ex7n3 { public static void main (String[] args) throws Exception { System.out.println (); Person person = new Person (); System.out.print ("Type in the name: "); String name = BasicIo.readString (); person.setName (name); while (true) { System.out.println (); System.out.print ("Type in the age: "); int age = BasicIo.readInteger (); boolean result = person.setAge (age); if (result == true) { break; } else { System.out.println ("Illegal age provided; try again!"); } } print_person (person); } // end of main public static void print_person (Person person) { System.out.print (person.getName () + " (") ; System.out.println (person.getAge () + ")") ; } // End of print_person } // end of class Ex7n3