public class Book
extends java.lang.Object
Constructor and Description |
---|
Book(java.lang.String author,
java.lang.String title,
int pages)
Creates a Book object with author, title and pages.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAuthor()
Sets the name of the author of the book.
|
int |
getPages()
Returns the number of pages in the book.
|
java.lang.String |
getTitle()
Returns the title of the book.
|
void |
setAuthor(java.lang.String author)
Sets the name of the author of the book.
|
void |
setPages(int pages)
Sets the number of pages in the book.
|
void |
setTitle(java.lang.String title)
Sets the title of the book.
|
java.lang.String |
toString() |
public Book(java.lang.String author, java.lang.String title, int pages) throws ZeroOrNegativeNumberException
author
- the author of the booktitle
- the title of the bookpages
- the number of pages in the bookZeroOrNegativeNumberException
public java.lang.String getAuthor()
public int getPages()
public java.lang.String getTitle()
public void setAuthor(java.lang.String author)
author
- the author of the bookpublic void setPages(int pages) throws ZeroOrNegativeNumberException
pages
- the number of pages in the bookZeroOrNegativeNumberException
- if pages parameter is zero or negativepublic void setTitle(java.lang.String title)
title
- the title of the bookpublic java.lang.String toString()
toString
in class java.lang.Object