/** * * demonstration of the manipulation of "Person" objects * */ import java.lancs.Person; public class Sample3n1 { public static void main (String[] args) { System.out.println () ; // step 1 - declare two "Person" variables Person person1 = new Person () ; Person person2 = new Person () ; // step 2 - set the attributes of "person1" person1.setForename ("John") ; person1.setSurname ("Smith") ; person1.setAge (24) ; // step 3 - set the attributes of "person2" person2.setForename ("Peter") ; person2.setSurname ("Wright") ; person2.setAge (19) ; // step 4 - display the attributes of "person2" System.out.print ("the second person is ") ; System.out.print (person2.getForename ()) ; System.out.print (" ") ; System.out.print (person2.getSurname ()) ; System.out.print (" (") ; System.out.print (person2.getAge ()) ; System.out.println (")") ; // step 5 - leave a blank line System.out.println () ; // step 6 - display the attributes of "person1" System.out.print ("the first person is ") ; System.out.print (person1.getForename ()) ; System.out.print (" ") ; System.out.print (person1.getSurname ()) ; System.out.print (" (") ; System.out.print (person1.getAge ()) ; System.out.println (")") ; } // end of method main } // end of class