hi i need help with c homework due today can 39 t use pointers we didn 39 t learn th 5188245
hi, I need help with C++ homework due today. Can't use pointers, we didn't learn those yet. See assignment below. I'm assuming the account number and balance are stored in the same input text file. Please help me, thank you.
Write a program to implement a small banking transaction system. Each account consists of an account number and balance stored in parallel arrays. The user of the program, a teller, can perform deposits, withdrawals and balance inquiries.
Read the existing account information for 15 customers from an input file into a pair of parallel arrays (assume the maximum number of customers the bank can handle is 50). The program should call a function to read data into the arrays until an end-of-file condition is encountered. The function should then return the number of records read.
Call another function to display the contents of both arrays. Label your output appropriately.
Write another function that will display the following menu and return the user’s choice:
Select one of the following:
W – Withdrawal
D – Deposit
B – Balance
Q – Quit
Note: Your program should not be case sensitive, i.e. upper/lower case responses are accepted. Redisplay your menu when an invalid selection is entered by the user.
If the user wants to quit, the program should once again call the function to output the contents of both arrays and terminate. Otherwise one of the following functions should be called to perform the desired transaction:
deposit
withdrawal (remember to take into account insufficient funds cases)
balance
Note: Each function will prompt the user to enter an account number and either perform the transaction or print an error message if the account does not exist.
The deposit, withdrawal and balance functions listed above should all call a function that searches the account number array for the account number entered by the user and return either its index in the array or a value of -1 to indicate that the account does not exist.
Submit a copy of the input file, your program and its output. Perform at least one withdrawal, one deposit, one balance inquiry and one invalid selection. As always, comment the program and label the output sufficiently.
Add a menu option and corresponding function to add new accounts.
Modify you program to output the contents of both arrays to a file after the user quits. You will need to modify your output function to do this .
This is what I have so far:
#include
#include
#include
#include
#include
using namespace std;
const int MAX_ARRAY_SIZE = 50;
int arrayA[MAX_ARRAY_SIZE];
int arrayB[MAX_ARRAY_SIZE];
char mainMenu(char &menuSelection);
int search(int account, int allAccounts[]);
void selectWithdrawl();
void selectDeposit();
void selectBalance();
int main() {
int index = 0;
char menuSelection;
ifstream inFile;
ofstream outfile;
inFile.open(“accounts.txt”);
if (inFile.fail()) {
cerr
abort();
}
outfile.open(“output.txt”);
if (outfile.fail()) {
cerr
abort();
}
while (!inFile.eof()) {
inFile >> arrayA[index];
inFile >> arrayB[index];
index++;
}
do {
mainMenu(menuSelection);
if (menuSelection == 'W' || menuSelection == 'w')
selectWithdrawl();
else if (menuSelection == 'D' || menuSelection == 'd')
selectDeposit();
else if (menuSelection == 'B' || menuSelection == 'b')
selectBalance();
else if (menuSelection == 'Q' || menuSelection == 'q')
menuSelection = 'q';
else
mainMenu(menuSelection);
} while (menuSelection != 'q' && menuSelection != 'Q');
return 0;
}
int search(int account, int allAccounts[]) {//user_account & arrayA are being passed
int f = -1;
for (int i = 0; i
if (account == allAccounts[i]) {
cout
f = i;
}
}
return f;
}
void displayData(int accountNo, float balance, int noOfCustomers) {
if (noOfCustomers == 0) {
cout
return;
}
cout
for (int i = 0; i
cout
}
char mainMenu(char& menuSelection) {
while (true) {
cout
cin >> menuSelection;
break;
}
return menuSelection;
}
void selectWithdrawl() {
cout
}
void selectDeposit() {
cout
}
void selectBalance() {
int user_account;
int is_found;
cout
cin >> user_account;
is_found = search(user_account, arrayA);
if (is_found != -1) {
cout
cout
}
else
cout
}