Practice · 2 of 2
Bank Account with guarded money
CHALLENGE
Difficulty: beginner+25 XP
Inside Solution, write static class Account with a private final String owner, private double balance, constructor Account(String owner, double startingBalance) (negative start → IllegalArgumentException), public void deposit(double) (must be positive, else IAE), public void withdraw(double) (must be positive AND not exceed balance, else IAE), and public double getBalance().
Press Submit to check your solution.
Back to lesson: Practice: Practice: Objects at Work