Practice · 3 of 4
State mutation
CHALLENGE
Difficulty: beginner+25 XP
Add two mutators to Account: void deposit(int amount) (increase balance) and void withdraw(int amount) (decrease it, but never below 0 — a withdraw attempt that overdraws leaves the balance unchanged). Both return nothing.
Press Submit to check your solution.
Back to lesson: Practice: Class workshop