/* * ======================================================================== * TestRelationship: Create a undirectional relationship between a customer * and a book object. * * Notice that the customer refers to a book, but this model a book does * not refer to a customer. * * Written by: Mark Austin December 2009 * ======================================================================== */ public class TestRelationship { public static void main ( String args [] ) { // Create book and customer objects. Book book = new Book(); book.setName("The Cat in the Hat"); book.setAuthor("Dr Seuss"); Customer customer = new Customer(); customer.setName("Angela Austin"); // Create unidirectional customer-book relationship. customer.setBook( book ); // Retrieve and print customer-book relationship. System.out.println ( customer.toString() ); System.out.println ( customer.getBook().toString() ); } }