librarytest
Class Item
java.lang.Object
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)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
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
-
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: