Package Starter

Class Book

java.lang.Object
Starter.Book

public class Book
extends java.lang.Object
Write a description of class Book here.
  • Constructor Summary

    Constructors 
    Constructor Description
    Book​(String t, String a, int y)
    Constructs a Book object
  • Method Summary

    Modifier and Type Method Description
    String getAuthor()
    Returns the author of this Book
    String getTitle()
    Returns the title of this Book
    int getYear()
    Returns the year this Book was published.
    boolean isBorrowed()
    Returns true if this Book is currently rented.
    void rentBook()
    This Book is marked as rented.
    void returnBook()
    This Book is set as not rented.
    String toString()
    Returns the String representation of this Book.

    Methods inherited from class java.lang.Object

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

    • Book

      public Book​(String t, String a, int y)
      Constructs a Book object
      Parameters:
      t - title of the Book
      a - author of the Book
      y - year Book was published
  • Method Details

    • rentBook

      public void rentBook()
      This Book is marked as rented.
    • returnBook

      public void returnBook()
      This Book is set as not rented.
    • isBorrowed

      public boolean isBorrowed()
      Returns true if this Book is currently rented.
      Returns:
      returns true if this Book is rented, false otherwise.
    • getTitle

      public String getTitle()
      Returns the title of this Book
      Returns:
      title of this Book
    • getAuthor

      public String getAuthor()
      Returns the author of this Book
      Returns:
      author of this Book
    • getYear

      public int getYear()
      Returns the year this Book was published.
      Returns:
      year of publication of this Book
    • toString

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