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 new Library object with given address.
  • Method Summary

    Modifier and Type Method Description
    void addBook​(Book book)
    Book object is added to catalog
    void borrowBook​(String title)
    Prints to console whether this Book is already rented, if it is not in the catalog, or if it has been rented successfully.
    String getAddress()
    Get the address of this Library
    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 * daysLate
    String toString()
    Returns the String representation of this Library.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Library

      public Library​(String a)
      Constructs a new Library object with given address.
      Parameters:
      a - Library's address as String
  • Method Details

    • getAddress

      public String getAddress()
      Get the address of this Library
      Returns:
      the address of this Library
    • addBook

      public void addBook​(Book book)
      Book object is added to catalog
      Parameters:
      book - Book object being added
    • borrowBook

      public void borrowBook​(String title)
      Prints to console whether Book is already rented, if it is not in the catalog, or if it has been rented successfully.
      Parameters:
      title - title of Book
    • printAvailableBooks

      public 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).
    • 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 of Book being returned
      daysLate - number of days late
    • toString

      public String toString()
      Returns the String representation of this Library.
      Overrides:
      toString in class java.lang.Object
      Returns:
      The String representation of this Library.