// Person4.java // Person4 class declaration creates a person3 object // This class is abstract; use for inheritance public abstract class Person4 extends Object { private String First; // first name private String Last; // last name private int age; // age // Person constructor initializes each instance variable to zero or empty; // ensures that each Time1 object starts in a consistent state public Person4() { setPerson( "George", "Smith", 20); } // set a new Person value // validity checks on the age; set invalid values to 20 public void setPerson( String First, String Last, int age) { this.First = First; this.Last = Last; this.age = ( ( age >= 0 && age < 100 ) ? age : 20 ); } // get first name public String getFirst() { return First; } // get last name public String getLast() { return Last; } public int getAge() { return age; } public void setFirst(String First) { this.First = First; } public void setLast(String Last) { this.Last = Last; } public void setAge(int age) { this.age = age; } public abstract String getType(); } // end class Person4 /************************************************************************** * (C) Copyright 1992-2003 by Deitel & Associates, Inc. and * * Prentice Hall. All Rights Reserved. * * * * DISCLAIMER: The authors and publisher of this book have used their * * best efforts in preparing the book. These efforts include the * * development, research, and testing of the theories and programs * * to determine their effectiveness. The authors and publisher make * * no warranty of any kind, expressed or implied, with regard to these * * programs or to the documentation contained in these books. The authors * * and publisher shall not be liable in any event for incidental or * * consequential damages in connection with, or arising out of, the * * furnishing, performance, or use of these programs. * *************************************************************************/