Excerpt of highly responsible class BankAccount. | Lecture 13 - slide 12 : 32 Program 2 |
public class BankAccount { private double interestRate; private string owner; private double balance; // ... public void Withdraw (double amount) { if (!AccountOK) ComplainAboutNonValidAccount(); else if (!this.EnoughMoney(amount)) ComplainAboutMissingMoney(); else balance -= amount; } public void Deposit (double amount) { if (amount >= 10000000) CheckIfMoneyHaveBeenStolen(); else if (!AccountOK) ComplainAboutNonValidAccount(); alse balance += amount; } } |