#Include #Include Using Namespace Class Protected Float Public
#Include #Include Using Namespace Class Protected Float Public
h> using namespace std; class cBankAct { protected: float Balance; public: cBankAct() { Balance = 1000; } cBankAct(float Amt){ Balance = Amt; } void depositMoney(float Amt) { Balance+= Amt; } void withdrawMoney(float Amt) { Balance -= Amt; } }; class cCheckingAct : public cBankAct { private: float numberofTransactions; public: cCheckingAct():cBankAct() //Default Construction { numberofTransactions = 0; }; cCheckingAct(float Amount):cBankAct(Amount) Constructor { numberofTransactions = 0; };
//Parameterized
void withdrawMoney(float Amt) { numberofTransactions ++; if(numberofTransactions > 3) Amt+=.5; if(Amt > Balance){ cout << "Insufficient funds for transaction. Canceling..."; return; } Balance -= Amt; } }; class cSavingsAct :public cBankAct {
void main() { cCheckingAct BobJohn(45000); cCheckingAct JaneDoe; JaneDoe.withdrawMoney(45); JaneDoe.depositMoney(90); BobJohn.withdrawMoney(90000); _getch();