Skip to main content

Practice · 2 of 4

State machine: the register

CHALLENGE
Difficulty: beginner+25 XP

Implement Register.spend(int c) to spec: if c fits in the balance, subtract it and return true; otherwise change nothing and return false.

Back to lesson: Practice: Integrated reps