Class Book

java.lang.Object
  |
  +--Book
All Implemented Interfaces:
UPC

public class Book
extends java.lang.Object
implements UPC

This class implements a simple book description. The complexity of multi-part ISBN codes, significant information about the authors, and so on and so forth is not dealt with in this simple example.


Constructor Summary
Book(java.lang.String theTitle, java.lang.String theISBN, java.lang.String[] theAuthors, long theUPC)
          Construct a new Book using the parameters provided.
Book(java.lang.String theTitle, java.lang.String theISBN, java.lang.String theAuthor, long theUPC)
          Construct a new Book using the parameters provided.
 
Method Summary
 java.lang.String[] getAuthors()
          Return the array of author names for this book.
 java.lang.String getISBN()
          Return the ISBN of the book.
 java.lang.String getTitle()
          Return the title of the book.
 long getUPC()
          Any class that implements the UPC interface must be able to say what its UPC code is.
 java.lang.String toString()
          return a String describing this Book
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Book

public Book(java.lang.String theTitle,
            java.lang.String theISBN,
            java.lang.String[] theAuthors,
            long theUPC)
Construct a new Book using the parameters provided.

Parameters:
theTitle - the title of the book
theISBN - the ISBN number for this book
theAuthors - an array holding the names of the authors
theUPC - The UPC code for this book

Book

public Book(java.lang.String theTitle,
            java.lang.String theISBN,
            java.lang.String theAuthor,
            long theUPC)
Construct a new Book using the parameters provided.

Parameters:
theTitle - the title of the book
theISBN - the ISBN number for this book
theAuthor - the name of the sole author
theUPC - The UPC code for this book
Method Detail

getUPC

public long getUPC()
Any class that implements the UPC interface must be able to say what its UPC code is.

Specified by:
getUPC in interface UPC
Returns:
the numeric UPC value. UPC codes are 12 digits in length.

getTitle

public java.lang.String getTitle()
Return the title of the book.

Returns:
the title of the book.

getISBN

public java.lang.String getISBN()
Return the ISBN of the book.

Returns:
the ISBN of the book.

getAuthors

public java.lang.String[] getAuthors()
Return the array of author names for this book. The reference returned is to a clone of the array so that the caller can't mess with it.

Returns:
the authors of the book.

toString

public java.lang.String toString()
return a String describing this Book

Overrides:
toString in class java.lang.Object
Returns:
a String description of the Book