librarytest
Class Item

java.lang.Object
  extended by librarytest.Item

public class Item
extends java.lang.Object

Formerly the Book class Item has data elements: ISBN (10 digits), title (string), type (enum),publisher (string), page information (how many pages) (integer), price (float), publication year (integer), checked out status (boolean) false=available, true=checked-out, Patron ID who checked out the item (int), due date (use LibraryDate class). Has methods: 1. Calculate how many days are left before the due date (or how many days overdue)


Constructor Summary
Item()
           
Item(double ISBN, java.lang.String title, ItemType type, java.lang.String publisher, int pageInfoHowMany, double price, int publicationYear, boolean checkedOut, int patronID, LibraryDate dueDate)
           
 
Method Summary
 int daysUntilDue()
          Calculate how many days are left before the due date (or how many days overdue
 LibraryDate getDueDate()
           
 double getISBN()
           
 int getPageInfoHowMany()
           
 int getPatronID()
           
 double getPrice()
           
 int getPublicationYear()
           
 java.lang.String getPublisher()
           
 java.lang.String getTitle()
           
 ItemType getType()
           
 boolean isCheckedOut()
           
 void setCheckedOut(boolean checkedOut)
           
 void setDueDate()
           
 void setDueDate(LibraryDate dueDate)
           
 boolean setISBN(double ISBN)
           
 boolean setPageInfoHowMany(int pageInfoHowMany)
           
 void setPatronID(int patronID)
           
 boolean setPrice(double price)
           
 boolean setPublicationYear(int publicationYear)
           
 void setPublisher(java.lang.String publisher)
           
 void setTitle(java.lang.String title)
           
 void setType(ItemType type)
           
 java.lang.String toString()
          Display the values for an item private double ISBN; private String title; private ItemType type; private String publisher; private int pageInfoHowMany; private double price; private int publicationYear; private boolean checkedOut; private int patronID; private LibraryDate dueDate;
 java.lang.String typeString(ItemType ty)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Item

public Item()

Item

public Item(double ISBN,
            java.lang.String title,
            ItemType type,
            java.lang.String publisher,
            int pageInfoHowMany,
            double price,
            int publicationYear,
            boolean checkedOut,
            int patronID,
            LibraryDate dueDate)
Parameters:
ISBN -
title -
type -
publisher -
pageInfoHowMany -
price -
publicationYear -
checkedOut -
patronID -
dueDate -
Method Detail

getISBN

public double getISBN()
Returns:

setISBN

public boolean setISBN(double ISBN)
Parameters:
ISBN -
Returns:

getTitle

public java.lang.String getTitle()
Returns:

setTitle

public void setTitle(java.lang.String title)
Parameters:
title -

getType

public ItemType getType()
Returns:

setType

public void setType(ItemType type)
Parameters:
type -

getPublisher

public java.lang.String getPublisher()
Returns:

setPublisher

public void setPublisher(java.lang.String publisher)
Parameters:
publisher -

getPageInfoHowMany

public int getPageInfoHowMany()
Returns:

setPageInfoHowMany

public boolean setPageInfoHowMany(int pageInfoHowMany)
Parameters:
pageInfoHowMany -
Returns:

getPrice

public double getPrice()
Returns:

setPrice

public boolean setPrice(double price)
Parameters:
price -
Returns:

getPublicationYear

public int getPublicationYear()
Returns:

setPublicationYear

public boolean setPublicationYear(int publicationYear)
Parameters:
publicationYear -
Returns:

isCheckedOut

public boolean isCheckedOut()
Returns:

setCheckedOut

public void setCheckedOut(boolean checkedOut)
Parameters:
checkedOut -

getPatronID

public int getPatronID()
Returns:

setPatronID

public void setPatronID(int patronID)
Parameters:
patronID -

getDueDate

public LibraryDate getDueDate()
Returns:

setDueDate

public void setDueDate(LibraryDate dueDate)
Parameters:
dueDate -

setDueDate

public void setDueDate()

daysUntilDue

public int daysUntilDue()
Calculate how many days are left before the due date (or how many days overdue

Returns:
int - positive is days until due, neg is days overdue

toString

public java.lang.String toString()
Display the values for an item private double ISBN; private String title; private ItemType type; private String publisher; private int pageInfoHowMany; private double price; private int publicationYear; private boolean checkedOut; private int patronID; private LibraryDate dueDate;

Overrides:
toString in class java.lang.Object
Returns:
a String

typeString

public java.lang.String typeString(ItemType ty)
Parameters:
ty -
Returns: