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 aBook
object -
Method Summary
Modifier and Type Method Description String
getAuthor()
Returns the author of thisBook
String
getTitle()
Returns the title of thisBook
int
getYear()
Returns the year thisBook
was published.boolean
isBorrowed()
Returns true if thisBook
is currently rented.void
rentBook()
ThisBook
is marked as rented.void
returnBook()
ThisBook
is set as not rented.String
toString()
Returns the String representation of thisBook
.
-
Constructor Details
-
Book
public Book(String t, String a, int y)Constructs a Book object- Parameters:
t
- title of theBook
a
- author of theBook
y
- yearBook
was published
-
-
Method Details
-
rentBook
public void rentBook()ThisBook
is marked as rented. -
returnBook
public void returnBook()ThisBook
is set as not rented. -
isBorrowed
public boolean isBorrowed()Returns true if thisBook
is currently rented.- Returns:
- returns true if this
Book
is rented, false otherwise.
-
getTitle
public String getTitle()Returns the title of thisBook
- Returns:
- title of this
Book
-
getAuthor
public String getAuthor()Returns the author of thisBook
- Returns:
- author of this
Book
-
getYear
public int getYear()Returns the year thisBook
was published.- Returns:
- year of publication of this
Book
-
toString
public String toString()Returns the String representation of thisBook
.- Overrides:
toString
in classjava.lang.Object
- Returns:
- String representation of this
Book
.
-