01
Overview

Putting an entire class together.

Fields, constructor, accessors, mutators, behavior methods — every AP class FRQ assembles these pieces in the same order.

A complete class follows a standard order: private instance variables, constructors, accessors, mutators, and behavior methods. Following this template makes your code easy to read and matches what AP graders expect.

The pieces work together: the constructor initializes the fields; accessors expose them; mutators change them safely; behavior methods do useful work using the state.

On the AP exam, class design FRQs ask you to write all these pieces from a written specification.

02
Core Concept

Standard class structure, in order.

Five sections; same order every time.

Complete Book class

public class Book {
    // 1. Instance variables
    private String title;
    private String author;
    private int pagesRead;
    private int totalPages;

    // 2. Constructor
    public Book(String title, String author, int totalPages) {
        this.title = title;
        this.author = author;
        this.totalPages = totalPages;
        this.pagesRead = 0;
    }

    // 3. Accessors
    public String getTitle() { return title; }
    public String getAuthor() { return author; }
    public int getPagesRead() { return pagesRead; }
    public int getTotalPages() { return totalPages; }

    // 4. Mutator
    public void readPages(int n) {
        pagesRead = pagesRead + n;
        if (pagesRead > totalPages) pagesRead = totalPages;
    }

    // 5. Behavior
    public boolean isFinished() {
        return pagesRead == totalPages;
    }

    public double percentComplete() {
        return 100.0 * pagesRead / totalPages;
    }
}

Constructor initializes everything

Every field gets a starting value — either from a parameter or a sensible default like 0 or null.

03
Key Vocabulary

Class-design vocabulary.

Standard structure terms.

Vocabulary
  • Constructor — special method that initializes a new object.
  • Field / instance variable — state stored in each object.
  • Accessor — returns a field.
  • Mutator — changes a field.
  • Behavior method — does something using state.
  • Default value — sensible initial value (0, null, "").
04
AP Exam Focus

How complete-class FRQs are scored.

Structure and correctness both matter.

Exam Focus
  • Private fields. Standard rubric point.
  • Constructor sets every field. Use parameters or defaults.
  • Match the spec's signatures. Method names, params, returns.
  • Use this as needed. Especially when params shadow fields.
05
Worked Example

Trace a Book through reading.

Fields update; behavior reflects state.

Worked Example AP-style reasoning

Setup. Book b = new Book("Dune", "Herbert", 600); — pagesRead = 0.

  • b.readPages(200) → pagesRead = 200.
  • b.percentComplete() → 100.0 * 200 / 600 = 33.33...
  • b.readPages(500) → pagesRead = 700, but capped to 600.
  • b.isFinished() → true.
  • b.percentComplete() → 100.0.
06
Common Mistakes

Complete-class pitfalls.

Missing constructor pieces or signature drift.

Watch Out
  • Constructor doesn't init every field. Some default to 0/null but that may be wrong.
  • Public fields. Loses encapsulation.
  • Wrong method names or types. Spec must match exactly.
  • Forgetting this. Causes self-assignment with shadowed params.
07
Reference Table

Class skeleton order.

Five sections.

Complete Class Reference

AP Quick Reference
SectionContentModifiers
1. FieldsInstance variablesprivate
2. ConstructorInit fieldspublic
3. AccessorsReturn fieldspublic
4. MutatorsChange fieldspublic
5. BehaviorUse statepublic
08
Practice Tip

How to master complete-class design.

Write the skeleton first; fill in bodies second.

Practice Strategy
  • MCQ Practice — verify all five sections appear in the right order.
  • Java Lab — write Book, Movie, Course classes from prose specs.
  • FRQ Practice — outline private fields, constructor, accessors, mutators, behaviors before filling in details.
09
Section · 09

Practice — attempt these now.

AP-style assessments aligned to this lesson. Time them.

FRQ Practice 30 min 19 marks Pending

AP CSA Unit 13 Topic 02 Complete Class Design FRQ Practice

AP-style topic practice assessment

Start