└── ATMDemo-master ├── images ├── bank1.png ├── bank2.png ├── bank3.png ├── bank4.png └── bank5.png ├── README.md └── bankDemo.cpp /ATMDemo-master/images/bank1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mustafa-Hassan2001/ATMDemo-master/HEAD/ATMDemo-master/images/bank1.png -------------------------------------------------------------------------------- /ATMDemo-master/images/bank2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mustafa-Hassan2001/ATMDemo-master/HEAD/ATMDemo-master/images/bank2.png -------------------------------------------------------------------------------- /ATMDemo-master/images/bank3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mustafa-Hassan2001/ATMDemo-master/HEAD/ATMDemo-master/images/bank3.png -------------------------------------------------------------------------------- /ATMDemo-master/images/bank4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mustafa-Hassan2001/ATMDemo-master/HEAD/ATMDemo-master/images/bank4.png -------------------------------------------------------------------------------- /ATMDemo-master/images/bank5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mustafa-Hassan2001/ATMDemo-master/HEAD/ATMDemo-master/images/bank5.png -------------------------------------------------------------------------------- /ATMDemo-master/README.md: -------------------------------------------------------------------------------- 1 | # ATM Demo C++ - College Project 2 | 3 | 4 | User Stories: 5 | 6 | 1. End user can access account with a PIN number. 7 | 2. After entering PIN number, user can select the type of account (Checking or Savings). 8 | 3. User can make a deposit or withdraw. 9 | 4. New balance is printed after each transaction. 10 | 5. After ending transactions user can exit from account. 11 | 12 | 13 | ![alt text](https://raw.githubusercontent.com/yemz/ATMDemo/master/images/bank1.png) 14 | ![alt text](https://raw.githubusercontent.com/yemz/ATMDemo/master/images/bank2.png) 15 | ![alt text](https://raw.githubusercontent.com/yemz/ATMDemo/master/images/bank3.png) 16 | -------------------------------------------------------------------------------- /ATMDemo-master/bankDemo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Program: ATM Demo 3 | Description: Program that assumes end user has already entered an ATM card. After entering PIN number the end user can select the type of account either 4 | Checking or Savings account and make a deposit or withdraw. Then it prints the results with the new balance after each transaction. 5 | */ 6 | // Libraries 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include //allows math round to decimal places 12 | 13 | using namespace std; 14 | // Declare class BankAccount 15 | class BankAccount { 16 | // Declare variables 17 | private: 18 | string pinNum; 19 | char accType; 20 | double balance; 21 | double amount; 22 | 23 | public: 24 | // Constructor of BankAccount 25 | BankAccount(){ 26 | // Initialize balance and amount variables 27 | balance = 0.0; 28 | amount = 0.0; 29 | } 30 | 31 | // Declare functions prototypes 32 | void pinNumber(); 33 | void accountType(); 34 | void balanceChecking(); 35 | void balanceSavings(); 36 | void deposit(); 37 | void withdraw(); 38 | void display(); 39 | }; // End class BankAccount 40 | 41 | // Function to retrieve pinNumber from end user 42 | void BankAccount::pinNumber() 43 | { 44 | cout << "________________________________________________________________________________"; 45 | cout << "\n\t\t\t ATM DEMO PROJECT" << endl; 46 | cout << "________________________________________________________________________________"; 47 | //prompts end user for the pin number to access bank account 48 | cout << "\n\t\t\t ENTER PIN NUMBER: \n" <> pinNum)) { 71 | // Reset the input 72 | cin.clear(); 73 | // Get string input 74 | while (cin.get() != '\n') 75 | continue; 76 | // Ask user to try again: 77 | cout << "\n\t\t\t Please enter a numeric Pin: "; 78 | } // End while cin 79 | 80 | // Allow user to re-enter pinNum 4 times before locking account 81 | } else if (i >= 4) { 82 | cout << "\n\t\t\t You account is Locked!\n"; 83 | cout << "\t\t\t You have reached the limit of tries." << endl; 84 | // If user enters any numeric invalid pin, allow to re-enter pin 85 | } else { 86 | cout << "\n\t\t\t Invalid Pin Number \n"; 87 | cout << "\t\t\t Enter Pin Number Again: \n"; 88 | cout << "\t\t\t\t "; 89 | cin >> pinNum; 90 | }// End else 91 | }// End for loop pinNum 92 | }// End pinNumber function 93 | 94 | // Function to retrieve account type from end user 95 | void BankAccount::accountType(){ 96 | cout << "\n\t\t\t Select Account Type:\n"; 97 | cout << "\t\t\t Checking 'C' or Savings 'S': "; 98 | cin >> accType; 99 | 100 | // If C or c is entered display Checking Account 101 | if(accType == 'C' || accType == 'c') { 102 | cout << "\t\t\t================================" << endl << endl; 103 | cout << "\t\t\t\tChecking Account" << endl << endl; 104 | cout << "\t\t\t================================" << endl << endl; 105 | // Else if S or s is entered display Savings Account 106 | } else if (accType == 'S' || accType == 's') { 107 | cout << "\t\t\t================================" << endl << endl; 108 | cout << "\t\t\t\tSavings Account" <> accType; 114 | } 115 | }// End getAccountType function 116 | 117 | // Deposit function 118 | void BankAccount::deposit(){ 119 | cout << "\n\t\t\t\t DEPOSIT\n"; 120 | cout << "\t\t\t Enter Deposit Amount $"; 121 | cin >> amount; 122 | cout << "\n\t\t\t========Deposit Receipt========" << endl << endl; 123 | cout << setprecision(2) << fixed; //round decimal 2 places 124 | cout << "\t\t\t Amount Deposited = $" << amount << endl << endl; 125 | balance += amount; 126 | cout << "\t\t\t New balance $" << balance << endl << endl; 127 | cout << "\t\t\t===============================" << endl; 128 | }// End deposit function 129 | 130 | // Withdraw function 131 | void BankAccount::withdraw(){ 132 | cout << "\n\t\t\t\t WITHDRAW\n"; 133 | cout << "\t\t\t Enter Withdraw Amount $"; 134 | cin >> amount; 135 | cout << "\n\t\t\t=======Withdraw Receipt==========" << endl << endl; 136 | cout << "\t\t\t Amount withdrawn = $" << amount << endl << endl; 137 | balance -= amount; 138 | cout << "\t\t\t New balance $" << balance << endl <> options; 173 | 174 | // Switch statement to call functions based on end user selected option 175 | switch (options) { 176 | case 0: pinNumber(); 177 | break; 178 | case 1: accountType(); 179 | break; 180 | case 2: deposit(); 181 | break; 182 | case 3: withdraw(); 183 | break; 184 | case 4: balanceChecking(); 185 | break; 186 | case 5: balanceSavings(); 187 | break; 188 | default: cout << "\n\t\t\t Invalid Option" << endl; 189 | } 190 | } 191 | } 192 | 193 | int main() 194 | { 195 | // Change screen text color 196 | system("color 0b"); 197 | // Declare BankAccount Object 198 | BankAccount bank; 199 | // Call functions 200 | bank.pinNumber(); 201 | bank.accountType(); 202 | bank.balanceChecking(); 203 | bank.balanceSavings(); 204 | bank.deposit(); 205 | bank.withdraw(); 206 | 207 | return 0; 208 | } 209 | --------------------------------------------------------------------------------