Textbook free response problem from the 2022 AP Computer Science A Exam.
Textbook is #2 from the from the 2022 AP Computer Science A Free Response problems.
https://apcentral.collegeboard.org/pdf/ap22-frq-computer-science-a.pdf?course=ap-computer-science-a
Textbook class
public class Textbook extends Book { private int edition; public Textbook(String bookTitle, double bookPrice, int edition) { super(bookTitle, bookPrice); this.edition = edition; } public int getEdition() { return edition; } public String getBookInfo() { return super.getBookInfo() + "-" + edition; } public boolean canSubstituteFor(Textbook otherTextbook) { return this.getTitle().equals(otherTextbook.getTitle()) && this.getEdition() >= otherTextbook.getEdition(); } }