Skip to main content

Practice ยท 2 of 2

Bank Account with guarded money

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().

Difficulty: beginner

Back to lesson: Practice: Practice: Objects at Work