Product - setPublisher(publisher); } @Override public...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.util.*; public abstract class Product implements Comparable{ protected String catalogNum; protected String title; protected String publisher; protected Date dueDate; protected Customer checkedTo; public Customer getCheckedTo() { return checkedTo; } public String getCatalogNum(){ return catalogNum; } public void setCatalogNum(String c){ catalogNum = c; } public String getTitle(){ return title; } public void setTitle(String title){ this.title = title; } public String getPublisher(){ return publisher; } public void setPublisher(String publisher){ this.publisher = publisher; } public Date getDueDate(){ return dueDate; } public void setDueDate(Date d){ dueDate = d; } public Product(){ this("","",""); } public Product(String catNum, String title, String publisher){ setCatalogNum(catNum); setTitle(title);
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: setPublisher(publisher); } @Override public String toString(){ return catalogNum + ", " + title + ", " + publisher; } public abstract Date findDueDate(Date checkoutDate); //complete the following methods public boolean checkOut(Customer c, Date checkoutDate) { if( getCheckedTo() != null ) return false; checkedTo =c; setDueDate(findDueDate(checkoutDate)); return true; } public void checkIn() { checkedTo = null; setDueDate(null); } public int compareTo(Object obj) { if (obj instanceof Product) { Product product = (Product)obj; if(getTitle().equals(product.getTitle())) { return 0; } else return getTitle().compareTo(product.getTitle()); } else { throw new ClassCastException(); } } // add any additional methods below as required by the specs }...
View Full Document

This note was uploaded on 03/25/2010 for the course CIS CIS3023 taught by Professor Seema during the Spring '10 term at Florida College.

Page1 / 2

Product - setPublisher(publisher); } @Override public...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online