PersonDriver - /* * PersonDriver: * * * * */ A driver class...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
/** * PersonDriver: A driver class to test * the functionality of the class * Person and learn how to split the main method * into sub-taks implemented as private static methods * in the driver class. */ import java.util.Scanner; i public class PersonDriver { p public static void main(String[] args) { p // // Creates Three Persons // System.out.println("Person #1"); Person person1 = new Person(getPersonName(),getPersonAge()); P System.out.println("\nPerson #2"); Person person2 = new Person(getPersonName(),getPersonAge()); P System.out.println("Person #3"); Person person3 = new Person(getPersonName(),getPersonAge()); P // Update each Person's age by adding 10 years. person1.setAge(person1.getAge()+10); person2.setAge(person2.getAge()+10); person3.setAge(person3.getAge()+10); System.out.println("After 10 years. ..\nStatistics:\n"); S System.out.println(Person.avgAge()); // Display the average age among all the Persons // by calling the static method avgAge of the class Person / System.out.println(Person.minAge());
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/15/2010 for the course CSCI 01209 taught by Professor Storm during the Fall '10 term at University of Georgia Athens.

Page1 / 3

PersonDriver - /* * PersonDriver: * * * * */ A driver class...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online