// A program that deals with PhoneEntry objects
// Second version, to accompany PhoneEntry class with behavior.

public class PhoneEntryMain {
    public static void main(String[] args) {
        // create two PhoneEntry objects
        PhoneEntry pe1 = new PhoneEntry();
        pe1.name = "Joe";
        pe1.phoneNo = "617-333-4444";

        PhoneEntry pe2 = new PhoneEntry();
        pe2.name = "Sue";
        pe2.phoneNo = "718-333-5555";

          // print each entry:
        System.out.println("pe1 is " + pe1.name + ": " + pe1.phoneNo);
        System.out.println("pe2 is " + pe2.name + ": " + pe2.phoneNo);
      
        // change area codes
        pe1.phoneNo = "413" + pe1.phoneNo.substring(3);
        pe2.phoneNo = "477" + pe2.phoneNo.substring(3);

        // print the entries again
        System.out.println("pe1 is " + pe1.name + ": " + pe1.phoneNo);
        System.out.println("pe2 is " + pe2.name + ": " + pe2.phoneNo);
        System.out.println("pe1 is " + pe1);  // not helpful: prints hex number (address)
    }
}
