2017 FRQ Question 2 - Class Design

2 min read

Gamified FRQ Quest: MultPractice Adventure

You are now a code hero in a game-like AP CSA challenge. Complete the mission by implementing MultPractice and earning stars.

Quest Briefing (FRQ Requirements)

Interface provided:

Code Runner Challenge

Implement MultPractice

View IPYNB Source
public interface StudyPractice {
    String getProblem();      // Returns the current practice problem
    void nextProblem();       // Advances to the next practice problem
}
Lines: 1 Characters: 0
Output
Click "Run" in code control panel to see output ...

Your class must:

  • implement StudyPractice
  • store two private ints: firstInteger (constant), secondInteger (increments)
  • getProblem() returns exact "x TIMES y"
  • nextProblem() increments secondInteger

Game Levels (Practice Path)

  1. Level 1: Starter — Base class
    • Build class with constructor and methods
    • Get 10 XP
  2. Level 2: Mid-game — State behavior
    • Ensure nextProblem() changes output sequence
    • Get 15 XP
  3. Level 3: Boss encounter — Edge-case challenge
    • Add optional reset() or skip(int n) as bonus
    • Get 20 XP + unlock badge

Challenge Scoreboard

  • 10 XP: Implement constructor + interface
  • 15 XP: getProblem() formatting accuracy
  • 15 XP: nextProblem() state update
  • 20 XP: Add a bonus feature (reset/skip/validate)

Total available XP: 60 (40 baseline + 20 bonus)

// CODE_RUNNER: Implement MultPractice
interface StudyPractice {
    String getProblem();
    void nextProblem();
}

class MultPractice implements StudyPractice {
    private int firstInteger;
    private int secondInteger;

    public MultPractice(int firstInteger, int initialSecondInteger) {
        this.firstInteger = firstInteger;
        this.secondInteger = initialSecondInteger;
    }

    public String getProblem() {
        return firstInteger + " TIMES " + secondInteger;
    }

    public void nextProblem() {
        secondInteger++;
    }

    // Bonus level: reset for extra XP
    public void reset(int newSecond) {
        secondInteger = newSecond;
    }
}

public class Main {
    public static void main(String[] args) {
        MultPractice p = new MultPractice(7, 3);
        System.out.println(p.getProblem());  // 7 TIMES 3
        p.nextProblem();
        System.out.println(p.getProblem());  // 7 TIMES 4
        p.reset(100);
        System.out.println(p.getProblem());  // 7 TIMES 100
    }
}
Main.main(null);

Boss Validation (Automated Testing)

Run the code. Expected output exactly:

  • 7 TIMES 3
  • 7 TIMES 4
  • 7 TIMES 100

If true, you defeat the boss and earn “Multiplicative Commander”.

Reward Tiers for Teachers

  • Star 1: Base requirement passed
  • Star 2: Sequence correctness
  • Star 3: Bonus method implemented
  • Star 4: Comments and narrative included
  • Star 5: Reflection written

Reflection (Victory Screen)

  1. What part of MultPractice felt most like a game mechanic?
  2. How does nextProblem() compare to “advancing to next level”?
  3. Suggest one extra feature to continue gamification (e.g., powerUp() that increments by 2).

Course Timeline