CJCoding With Joseph

Encapsulated Bank Account

Build a class BankAccount from scratch. Requirements:
- a private double balance set by the constructor from a starting amount
- Deposit(double amount) adds to the balance, but ignores a negative amount
- Withdraw(double amount) subtracts from the balance, but ignores a negative amount and ignores any withdrawal larger than the current balance
- a read-only Balance property returns the balance

Do not write a Main method.

Starting at 100, after Deposit(50) then Withdraw(30) the program prints:
120

Expected Output:

120
Topics:
Encapsulation
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cw, cr, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.