Package Starter
Class Library
java.lang.Object
Starter.Library
public class Library
extends java.lang.Object
Write a description of class Library here.
-
Constructor Summary
Constructors Constructor Description Library(String a)
Constructs a newLibrary
object with given address. -
Method Summary
Modifier and Type Method Description void
addBook(Book book)
Book
object is added to catalogvoid
borrowBook(String title)
Prints to console whether thisBook
is already rented, if it is not in the catalog, or if it has been rented successfully.String
getAddress()
Get the address of thisLibrary
void
printAvailableBooks()
Prints to console whether no books are in the catalog or prints the list of books (and says if they are currently rented).void
returnBook(String title, int daysLate)
Book with title is marked as returned and the fine amount is given, which is FINE * daysLateString
toString()
Returns the String representation of thisLibrary
.
-
Constructor Details
-
Library
public Library(String a)Constructs a newLibrary
object with given address.- Parameters:
a
-Library
's address asString
-
-
Method Details
-
getAddress
public String getAddress()Get the address of thisLibrary
- Returns:
- the address of this
Library
-
addBook
Book object is added to catalog- Parameters:
book
-Book
object being added
-
borrowBook
public void borrowBook(String title)Prints to console whetherBook
is already rented, if it is not in the catalog, or if it has been rented successfully.- Parameters:
title
- title ofBook
-
printAvailableBooks
public void printAvailableBooks()Prints to console whether noBook
s are in the catalog or prints the list ofBook
s (and says if they are currently rented). -
returnBook
public void returnBook(String title, int daysLate)Book
with title is marked as returned and the fine amount is given, which is FINE * daysLate- Parameters:
title
- title ofBook
being returneddaysLate
- number of days late
-
toString
public String toString()Returns the String representation of thisLibrary
.- Overrides:
toString
in classjava.lang.Object
- Returns:
- The String representation of this
Library
.
-