public class Textbook extends Book
{
private int edition;
public Textbook(String bookTitle, double bookPrice, int ed)
{
super(bookTitle, bookPrice);
edition = ed;
}
public int getEdition()
{
return edition;
}
public String getBookInfo()
{
return super.getBookInfo() + "-" + edition;
}
public boolean canSubstituteFor(Textbook otherTextbook)
{
return getTitle().equals(otherTextbook.getTitle()) &&
edition >= otherTextbook.edition;
}
}
|