
June 3rd, 2007, 11:43 AM
|
|
Registered User
|
|
Join Date: Jun 2007
Posts: 2
Time spent in forums: 48 m 45 sec
Reputation Power: 0
|
|
|
Need Help Urgently Please
hey guys i was wondering if you could help me out with this program. Here it is:
Patrons of a library can borrow up to three books. A patron, therefore, has a name and up to three books. A book has an author and a title. Design and implement two classes, Patron and Book, to represent these objects and the following behavior:
-The client can instantiate a book with a title and author
-The client can examine but not modify a book's title or author
-The client can ask a patron whether it has borrowed a given book(identified by title)
-The client can tell a patron to return a given book(identified by title)
- The client can tell a patron to borrow a given book
The Patron class should use a seperate instance variable for each book (a total of three). Each of these variables is initially null. When a book is borrowed, the patron looks for a variable that is not null. If no such variable is found, the method returns false. If a null variable is found, it is reset to the new book and the method returns true. Similar considerations apply to the other methods. Use the method aString.equals(aString) to compare two strings for equality. Be sure to include appropriate toString methods for the classes and test them with a tester program.
Thanks guys
|