// package chapter9; /** * Title: Chapter 9, "Object-Oriented Software Development" * Description: Examples for Chapter 9 * Copyright: Copyright (c) 2000 * Company: Armstrong Atlantic State University * @author Y. Daniel Liang * @version 1.0 */ // Person.java: Encapsulate borrower information // import chapter8.Name; public class Person { private Name name; private Address address; /**Default constructor*/ public Person() { this(new Name("John", 'F', "Smith"), new Address("100 Main", "Savannah", "GA", "31411")); } /**Construct a person with specified name and address*/ public Person(Name name, Address address) { this.name = name; this.address = address; } /**Return name*/ public Name getName() { return name; } /**Set a new name*/ public void setName(Name name) { this.name = name; } /**Return address*/ public Address getAddress() { return address; } /**Set a new address*/ public void setAddress(Address address) { this.address = address; } /**Override the toSring method*/ public String toString() { return '\n' + name.getFullName() + '\n' + address.getFullAddress() + '\n'; } }