Question: #include #include #include #define MIN_BALANCE 100 using namespace std; class Account { string firstName, lastName; int accountNumber; int balance; int pin; public: void setFname(string fname);

#include #include #include #define MIN_BALANCE 100 using namespace std;

class Account { string firstName, lastName; int accountNumber; int balance; int pin; public: void setFname(string fname); void setLname(string lname); void setAccNo(int accNo); void setBalance(int sbalance); void setpin(int pin); Account(string fname = " ", string lname = " ", int accNo = 0) { setFname(fname); setLname(lname); setAccNo(accNo); setpin(pin); } string getFname(); string getLname(); int getAccNo(); int getBalance(); void getWithdrawal(int wtd); int getDeposit(int dpo); //~Account(); };

void Account::setFname(string fname) { firstName = fname; }

void Account::setLname(string lname) { lastName = lname; }

void Account::setAccNo(int accNo) { accountNumber = accNo; } void Account::setpin(int pin) { pin=123456; } void Account::setBalance(int sbalance) { try { if(sbalance < MIN_BALANCE) { throw 100; } balance = sbalance; } catch(int balance) { cout << " Error:Minimun Balance must be more than : " << balance; cout << " Minimum Balance: " << MIN_BALANCE; } }

string Account::getFname() { return firstName; }

string Account::getLname() { return lastName; }

int Account::getAccNo() { return accountNumber; }

int Account::getBalance() { return balance; }

void Account::getWithdrawal(int wtd) { fstream fi; fi.open("account.txt", ios::in | ios::app); try { if(balance - wtd < MIN_BALANCE) { throw 101; } balance -= wtd; fi << " Withdrawal: " << wtd; } catch(int e) { cout << " Error: The Amount Exceed current balance Withdrawal cannot exceed " << balance; } fi.close(); }

int Account::getDeposit(int dpo) { fstream fi; fi.open("account.txt", ios::in | ios::app); balance += dpo; fi << " Deposit: " << dpo; fi.close(); return balance; }

int main() { fstream fi; fi.open("account.txt", ios::in | ios:: out | ios::trunc); Account a; string fname, lname; int accNo, balance, choice, deposit, withdraw; int pin = 123456; cout << "\t********************************************************** " << endl << " \t\t THE BMMH FTKMP BANK \t\t\t ------* WELCOME *------ " << endl << "\t********************************************************** " << "\t\t\t\tUSER LOGIN" << endl; cout << " \t\tEnter First Name: "; cin >> fname; a.setFname(fname); fi << "First Name: " << fname << endl; cout << " \t\tEnter Last Name: "; cin >> lname; a.setLname(lname); fi << "Last Name: " << lname << endl; cout << " \t\t\tEnter PIN: "; cin >> pin; cout << " "; a.setAccNo(accNo); fi << "A/c No: " << accNo << endl; while (pin != 123456) { cout << "\t********************************************************** " << endl << " \t\t THE BMMH FTKMP BANK \t\t\t ------* WELCOME *------ " << endl << "\t********************************************************** " << "\t\t\t\tUSER LOGIN " << endl << "\t\t INVALID PIN WAS ENTERED " << endl; cout <<" Enter PIN: "; cin >> pin; cout << " "; } cout << " Enter Balance: "; cin >> balance; a.setBalance(balance);

while(choice != 3) { cout << " 1)Deposit"; cout << " 2)Withdraw"; cout << " 3)Exit"; cout << " Select any given option to proceed: "; cin >> choice; switch(choice) { case 1: cout << " Enter Deposit Amount: "; cin >> deposit; a.getDeposit(deposit); cout << " Your Current Balance: " << a.getBalance(); break;

case 2: cout << " Enter Withdrawal Amount: "; cin >> withdraw; a.getWithdrawal(withdraw); cout << " Your Current Balance: " << a.getBalance(); break; case 3: break;

default: cout << " Enter Valid Option"; break; } } fi.close(); return 0; }

Please make a flowchart based on the C++ program code above

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!