Name: Anonymous 2013-03-14 18:31
programmed in C++ and not C?
If they are going to use OO (false-OO) then they should use D.
If they are going to use OO (false-OO) then they should use D.
Balance: 150
deposit D = !Balance+D
withdraw W = !Balance: max 0 Balance-W
() balance: 150
deposit: [d | balance: balance + d]
withdraw: [w | balance: (0 max: balance - w)]
class Account {
public:
int balance;
Account(init startBalance) {
balance = startBalance;
}
void deposit(int d) {
balance += d;
}
void withdraw(int w) {
balance = max(0, balance-w);
}
};
Account(150);