|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object proj3.Library
public class Library
Class Invariant:
Number of books and number of patrons are non-negative
and correctly indicate the number of books and patrons that are in the Library
Field Summary | |
---|---|
static int |
MAX_COPIES
|
Method Summary | |
---|---|
java.lang.String |
addBook(java.lang.String title,
int copies,
java.lang.String authorFirst,
java.lang.String authorLast)
Preconditions: Number of copies must be positive, but not more than MAX_COPIES One, but not both, of authorFirst and authorLast may be null Postcondition: The book is added to the library and the number of books in the library is incremented |
java.lang.String |
addPatron(java.lang.String first,
java.lang.String last)
Preconditions: none Postcondition: The patron is added to the list of patrons, the number of patrons in the library is incremented and a library card number is assigned. |
java.lang.String |
checkOutBook(java.lang.String title,
java.lang.String fName,
java.lang.String lName)
Preconditions: none Postcondition: The book is checked out to the specified patron |
java.lang.String[] |
getAllBooks()
Preconditions: none |
java.lang.String[] |
getAllPatrons()
Preconditions: none |
java.lang.String |
getBook(java.lang.String title)
Preconditions: none |
java.lang.String |
getPatron(java.lang.String fName,
java.lang.String lName)
Preconditions: none |
java.lang.String |
returnBook(java.lang.String title,
java.lang.String fName,
java.lang.String lName)
Preconditions: none Postcondition: The specified book is returned and available to be checked out again |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MAX_COPIES
Method Detail |
---|
public java.lang.String addBook(java.lang.String title, int copies, java.lang.String authorFirst, java.lang.String authorLast)
title
- - the title of the book to add to the librarycopies
- - the number of copies of the book added to the libraryauthorFirst
- - the author's first name (may be null)authorLast
- - the author's last name (may be null)
public java.lang.String addPatron(java.lang.String first, java.lang.String last)
first
- - the first name of the patron to add (may not be null)last
- - the last name of the patron to add (may not be null)
public java.lang.String checkOutBook(java.lang.String title, java.lang.String fName, java.lang.String lName)
title
- - the title of the book to be checked outfName
- - the first name of the patron who wishes to check out the booklName
- - the last name of the patron who wishes to check out the book
public java.lang.String[] getAllBooks()
public java.lang.String[] getAllPatrons()
public java.lang.String getBook(java.lang.String title)
title
- - the title of the book
public java.lang.String getPatron(java.lang.String fName, java.lang.String lName)
fName
- - the first name of the patron whose information should be returnedlName
- - the last name of the patron whose information should be returned
public java.lang.String returnBook(java.lang.String title, java.lang.String fName, java.lang.String lName)
title
- - the title of the book being returnedfName
- - the first name of the patron returning the booklName
- - the last name of the patron returning the book
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |