Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#include #include #include #include #include using namespace std; / / account skeleton class BankAccount { public: int accNumber; / / acoount number char fName; /
#include
#include
#include
#include
#include
using namespace std;
account skeleton
class BankAccount
public:
int accNumber; acoount number
char fName; first name
char lname; last name
char phoneNum ; phone number
char street ;
char City ;
char postcode;
double balance;
BankAccount int accNumber, char fName, char lname char phoneNum, char street, char City, char postcode, double balance
this accNumber accNumber;
this fName fName;
this lname lname;
this phoneNum phoneNum;
this street street;
this City City;
this postcode postcode;
this balance balance;
bool operator const BankAccount& aconst
return aaccNumberaccNumber;
;
void readAcc const char& filename, vector Accountreading accounts
ifstream filefilename;
if fileisopen
int accNumber;
char fName, lnamephoneNum,street,City,postcode;
double balance;
whilefileaccNumberfNamelnamephoneNumstreetCitypostcodebalance
Account.pushbackBankAccountaccNumber fName, lnamephoneNum,street,City,postcode,balance;
file.close;
else
cout"File cannot be read!" Account
ofstream filefilename;
if fileisopen
forconst auto& account : Account
fileAccount;
couto: Open Account: accNumber;
for auto& account : Account
if accountaccNumber accNumber
account.balance amount;
cout amount deposited to account accNumber endl;
break;
break;
case w:
cout "Enter withdrawal amount: ;
cin amount;
for auto& account : Account
if accountaccNumber accNumber
if accountbalance amount
account.balance amount;
cout amount withdrawn from account accNumber endl;
else
cout "Insufficient funds in account accNumber endl;
break;
break;
case a:
case s:
cout"Account Number: ;
cinaccNumber;
break;
case p:
break;
default:
continue;
return ;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started