```1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 ``` ```#include using namespace std; class BankAccount { private: double balance; // holds the current account balance double interestRate; // holds the interest rate for the current period double interest; // holds the interest earned for the current period int numTransactions; // holds the current number of transactions public: BankAccount(); void setInterestRate(double); void makeDeposit(double); bool makeWithdraw(double); void computeInterest(); double getInterestRate(); double getBalance(); double getInterest(); int getNumTransactions(); }; BankAccount::BankAccount() { balance = 0; interestRate = 0.056; interest = 0; numTransactions = 0; } void BankAccount::setInterestRate(double interestRate) { this->interestRate = interestRate; } void BankAccount::makeDeposit(double deposit) { balance += deposit; numTransactions++; } bool BankAccount::makeWithdraw(double withdraw) { if (balance < withdraw) return false; else { balance -= withdraw; numTransactions++; return true; } } void BankAccount::computeInterest() { interest = interestRate * balance; balance += interest; } double BankAccount::getInterestRate() { return interestRate; } double BankAccount::getBalance() { return balance; } double BankAccount::getInterest() { return interest; } int BankAccount::getNumTransactions() { return numTransactions; } void heading(); void displayMenu(); void makeDeposit(BankAccount &depositAmount); void makeWithdraw(BankAccount &withdrawAmount); int main() { heading(); cout << endl; displayMenu(); BankAccount savings; int userChoice; cin >> userChoice; for (userChoice; userChoice > 6;) { cout << endl; cout << "There is no option " << userChoice << ". Please choose a task that is listed." << endl; cout << endl; displayMenu(); cin >> userChoice; } if (userChoice == 6) { cout << endl; cout << "Thank you. Please wait." << endl; cout << endl; cout << "Thank you for being a loyal customer!" << endl; cout << endl; } if (userChoice == 1) { makeDeposit(savings); } if (userChoice == 2) { makeWithdraw(savings); } if (userChoice == 3) { savings.getBalance(); } if (userChoice == 4) { savings.getNumTransactions(); } if (userChoice == 5) { savings.getInterest(); } } void heading() { cout << "/********************************************************************************************" << endl; cout << "* Course Name: CMPS 191 – Modular Programming and Algorithms Development II" << endl; cout << "* Project 2" << endl; cout << "* Section: 01" << endl; cout << "* Semester: Spring 2013" << endl; cout << "*" << endl; cout << "* Project Members:" << endl; cout << "* Leader: William R. Veal III" << endl; cout << "*" << endl; cout << "*" << endl; cout << "* Instructor: Dr. Mathieu Kourouma" << endl; cout << "*" << endl; cout << "* Description:" << endl; cout << "* Provide here a brief description of the purpose of the project" << endl; cout << "*" << endl; cout << "* Due Date: Wednesday, March 26, 2013 by 11:59 PM on Blackboard" << endl; cout << "*" << endl; cout << "* Certificate of Authentication:" << endl; cout << "*" << endl; cout << "* We, the listed group members:" << endl; cout << "* Claim that this project’s work fully our own work." << endl; cout << "* We wrote this program independently." << endl; cout << "* We did not copy any part of the code from other group members." << endl; cout << "* We did not share at all our codes with other group members." << endl; cout << "* We are only allowed to seek help from the instructor of this course and group members" << endl; cout << "*" << endl; cout << "* Signature: WRVIII" << endl; cout << "*" << endl; cout << "**********************************************************************************************/" << endl; } void displayMenu() { cout << "----------------------------------------------------------------------------------------------------------------------------------" << endl; cout << " Welcome to SUBR's Credit Union Banking System" << endl; cout << "-----------------------------------------------------------------------------------------------------------------------------------" << endl; cout << "" << endl; cout << "Please select from the following menu:" << endl; cout << " " << endl; cout << "1. Make a deposit" << endl; cout << "2. Make a withdraw" << endl; cout << "3. Display account balance" << endl; cout << "4. Display the number of transactions" << endl; cout << "5. Display interest earned " << endl; cout << "6. Exit the banking system" << endl; cout << " " << endl; cout << "Make your selection: "; } void makeDeposit(BankAccount &depositAmount) { double deposit; cout << "Enter the amount you wish to deposit: "; cin >> deposit; cout << endl; depositAmount.makeDeposit(deposit); cout << "Your deposit is " << deposit << endl; } void makeWithdraw(BankAccount &withdrawAmount) { double withdraw; cout << "Enter the amount you wish to withdraw: "; cin >> withdraw; if (!withdrawAmount.makeWithdraw(withdraw)) cout << "The amount you want to withraw is larger than the balance." << endl; } ```
 ```1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 ``` ```/******************************************************************************************** * Course Name: CMPS 191 – Modular Programming and Algorithms Development II * Project 2 * Section: 01 * Semester: Spring 2013 * * Project Members: * Leader: William R. Veal III * * * Instructor: Dr. Mathieu Kourouma * * Description: * Provide here a brief description of the purpose of the project * * Due Date: Wednesday, March 26, 2013 by 11:59 PM on Blackboard * * Certificate of Authentication: * * We, the listed group members: * Claim that this project’s work fully our own work. * We wrote this program independently. * We did not copy any part of the code from other group members. * We did not share at all our codes with other group members. * We are only allowed to seek help from the instructor of this course and group members * * Signature: WRVIII * **********************************************************************************************/ ---------------------------------------------------------------------------------------------------------------------------------- Welcome to SUBR's Credit Union Banking System ----------------------------------------------------------------------------------------------------------------------------------- Please select from the following menu: 1. Make a deposit 2. Make a withdraw 3. Display account balance 4. Display the number of transactions 5. Display interest earned 6. Exit the banking system Make your selection: ```