Ap Csa 2022 Frq 2 Textbook
AP CSA 2022 FRQ 2: Textbook
Complete solution, scoring rubric, and walkthrough — verified from the official College Board PDF
| Question Type | Class Writing |
| Skills Tested | Inheritance, super() constructor call, method override, String equals() |
| Difficulty | Medium |
| Recommended Time | 22 minutes |
What This Problem Asks
2022 AP CSA FRQ 2 Textbook asks students to write a complete Textbook class that extends the provided Book class. The subclass adds an edition number, overrides getBookInfo using super.getBookInfo(), and implements canSubstituteFor which returns true if the current book has the same title and a greater-or-equal edition.
What This FRQ Tests
This FRQ tests Unit 3: Class Creation (inheritance, extends, super(), method overriding) and Unit 1 (String equals()).
Official Question & PDF
PDF cannot display on this device. Open PDF directly →
Provided Code
public class Book
{
private String title;
private double price;
public Book(String bookTitle, double bookPrice) { /* not shown */ }
public String getTitle() {
return title;
}
public String getBookInfo() {
return title + "-" + price;
}
// Other methods not shown.
}
// You will write the complete Textbook class (extends Book)
// A Textbook has: String title, double price (from Book) + int edition
// getBookInfo() returns "title-price-edition"
// canSubstituteFor(Textbook other) returns true if same title AND edition >= other's edition
Part A — 9 Points
Write the complete Textbook class. Must: extend Book, have a constructor with title/price/edition parameters calling super, include getEdition(), canSubstituteFor(Textbook), and override getBookInfo().
Write Your Solution
Scoring Rubric — 9 Points
| +1 | Class header: public class Textbook extends Book
|
| +1 | Appropriate private instance variable for edition; constructor initializes it |
| +1 | Constructor calls super with title and price parameters |
| +1 | Constructor header: Textbook(String, double, int) declared public
|
| +1 | Declares public headers for getEdition, canSubstituteFor, getBookInfo
|
| +1 |
getEdition returns the edition value |
| +1 |
canSubstituteFor correctly compares titles using equals AND editions using >=
|
| +1 |
canSubstituteFor uses && to combine both conditions |
| +1 |
getBookInfo overrides correctly calling super.getBookInfo() and appending the edition |
Complete Solution
public class Textbook extends Book
{
private int edition;
public Textbook(String title, double price, int edition)
{
super(title, price);
this.edition = edition;
}
public int getEdition()
{
return edition;
}
public boolean canSubstituteFor(Textbook other)
{
return getTitle().equals(other.getTitle()) &&
edition >= other.getEdition();
}
public String getBookInfo()
{
return super.getBookInfo() + "-" + edition;
}
}
Book class has no getPrice() accessor method. You can’t access price directly since it’s private to Book. Calling super.getBookInfo() returns "title-price" which you then append "-edition" to.Common Mistakes to Avoid
Without extends Book, this is not a subclass and loses the first rubric point. The class header must explicitly declare the inheritance relationship.
Wrong
public class Textbook
Correct
public class Textbook extends Book
The problem states title and price must be maintained in Book. The constructor must call super(title, price) to initialize those fields. A Textbook constructor without a super call loses the third rubric point.
Wrong
public Textbook(String title, double price, int edition) {
this.edition = edition; // missing super() call!
}
Correct
public Textbook(String title, double price, int edition) {
super(title, price); // pass title and price to Book
this.edition = edition;
}
Title is a String. String equality must use .equals(), not ==.
Wrong
return getTitle() == other.getTitle() && edition >= other.getEdition();
Correct
return getTitle().equals(other.getTitle()) && edition >= other.getEdition();
Exam Tips
Book’s private price field directly. The only way to get "title-price" in the string is calling super.getBookInfo().canSubstituteFor takes a Textbook parameter, not a Book. Getting the parameter type wrong loses the method header point.Scoring Summary
| Part | Method | Points |
|---|---|---|
| Total (complete class) | 9 |
Want the Complete 2022 FRQ Solutions?
Browse all past AP CSA FRQs with full solutions and scoring breakdowns.
Related FRQs
Class Writing 2021 FRQ 2: CombinedTable — Complete class composing two SingleTable objects Class Writing 2023 FRQ 2: Sign — Complete class with ceiling division and getLines Class Writing 2019 FRQ 2: StepTracker — Complete fitness tracking classStudy the Concepts
Unit 3 Study Guide → Unit 1 Study Guide →
Struggling with FRQs? Get 1-on-1 Help
Work directly with Tanner — AP CS teacher with 11+ years experience and 1,845+ verified tutoring hours. 54.5% of students score 5s (vs. 25.5% national average).
5-session packages at $125/hr. Venmo, Zelle, PayPal, or credit card.
Frequently Asked Questions
What does 2022 AP CSA FRQ 2 Textbook test?
FRQ 2 tests writing a complete subclass with inheritance. Students must use extends, call super() in the constructor, override getBookInfo() using super.getBookInfo(), and implement canSubstituteFor with String equals() and >= comparison.
Why must canSubstituteFor use >= for edition comparison?
The problem says the current Textbook is a valid substitute if its edition is greater than OR equal to the other textbook's edition. Using > would fail for equal editions.
How do I get the price into getBookInfo without a getPrice() method?
Call super.getBookInfo() which returns 'title-price'. Then append '-' and the edition number. Never try to access price directly since it's private to Book.
How many points is FRQ 2 Textbook worth?
9 points total for the complete Textbook class.
Get in Touch
Whether you're a student, parent, or teacher — I'd love to hear from you.
Just want free AP CS resources?
Enter your email below and check the subscribe box — no message needed. Students get daily practice questions and study tips. Teachers get curriculum resources and teaching strategies.
Message Sent!
Thanks for reaching out. I'll get back to you within 24 hours.
Prefer email? Reach me directly at [email protected]