Question: Please comment code with the following guidelines: Each class source code and header file should be preceded by the following documentation header: /////////////////////////////////////////////////////////////////////// // //
Please comment code with the following guidelines:
Each class source code and header file should be preceded by the following documentation header:
///////////////////////////////////////////////////////////////////////
//
// Class: className
//
// Description:
// Description of the class and its purpose
//
// List of data members
//
// List of member functions
//
///////////////////////////////////////////////////////////////////////
Each member or non-member function should be preceded by the following documentation header:
///////////////////////////////////////////////////////////////////////
//
// Function: functionName
//
// Description:
// Description of the function
//
// Parameters:
// firstParam : first parameter's description
// secondParam : second parameter's description
//
// Returns:
// returnVal : description of what is returned to caller
//
///////////////////////////////////////////////////////////////////////
#include
using namespace std;
class BankAccount { public: const int uid; BankAccount() : uid(accountID++) { accountBalance = 0.0; }
BankAccount(double balance1) : uid(accountID++) { accountBalance = balance1; }
int get_actNumber() { return uid; } void deposit(double amount) { accountBalance = accountBalance + amount; } void withdraw(double amount) { accountBalance = accountBalance - amount; } double get_balance() { return accountBalance; } int count() { return uid; }
protected: double accountBalance; static int accountID; };
int BankAccount::accountID = 100;
class SavingsAccount : public BankAccount { public: SavingsAccount(double balance) : BankAccount(balance) { rate = .06; }
void set_interestRate(double rate) { rate = rate; }
double get_interestRate() { return rate; }
void postInterest() { accountBalance += (accountBalance * rate); }
void withDraw(double amount) { if (accountBalance >= amount) { accountBalance = accountBalance - amount; } else { cout << "Insufficient funds. Withdrawl transaction rejected, balance remains the same" << endl; } }
void displayAccountInfo() { cout << "Interest Saving ACCT#:" << get_actNumber() << " Balance: $" << get_balance() << endl; }
void calculateMonthlyInterest() { accountBalance = accountBalance + (rate * accountBalance); } protected: double rate;
};
class CheckingAccount : public BankAccount { private: int fee; float minBalance; float rate;
public: CheckingAccount(double balance) : BankAccount(balance) { //_number = get_actNumber(); fee = 50; minBalance = 500; rate = 0.04; }
void set_interestRate(double rate) { rate = rate; } double get_interestRate() { return rate; } void set_minBalance(double minBal) { minBalance = minBal; } double get_minBalance() { return minBalance; } bool checkMin() { if (accountBalance >= minBalance) { return true; } else return false; } void set_fee(double fee1) { fee = fee1; } double get_fee() { return fee; } void postInterest() { accountBalance += (accountBalance * rate); } void withDraw(double amount) { if (accountBalance < amount) { cout << "insufficient funds. Withdrawl rejected, does not affect balance." << endl; } else { if (accountBalance - amount >= minBalance) { accountBalance = accountBalance - amount; } else { accountBalance -= (amount + fee);
}
} } void displayAccountInfo() { cout << "Interest Checking ACCT#:" << get_actNumber() << " Balance: $" << get_balance() << endl; } void calculateMonthlyInterest() { accountBalance = accountBalance + (rate * accountBalance); } };
int main() { CheckingAccount jackAccount(1000); CheckingAccount lisaAccount(450); SavingsAccount samirAccount(9300); SavingsAccount ritaAccount(32); jackAccount.deposit(1000); lisaAccount.deposit(2300); samirAccount.deposit(800); ritaAccount.deposit(500); jackAccount.calculateMonthlyInterest(); lisaAccount.calculateMonthlyInterest(); samirAccount.calculateMonthlyInterest(); ritaAccount.calculateMonthlyInterest(); cout << "***********************************" << endl; jackAccount.displayAccountInfo(); lisaAccount.displayAccountInfo(); samirAccount.displayAccountInfo(); ritaAccount.displayAccountInfo(); cout << "***********************************" << endl << endl; jackAccount.withDraw(250); lisaAccount.withDraw(350); samirAccount.withdraw(120); ritaAccount.withdraw(290); cout << "********After withdrawals ***************" << endl; jackAccount.displayAccountInfo(); lisaAccount.displayAccountInfo(); samirAccount.displayAccountInfo(); ritaAccount.displayAccountInfo(); cout << "***********************************" << endl << endl; system("pause"); return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
