Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You are tasked with writing a program which will write a monthly account summary

ID: 3773302 • Letter: Y

Question

You are tasked with writing a program which will write a monthly account summary of customers' transactions at the bank at which you are employed. The monthly transactions are stored in a file called transactions.txt in the follow form: 123 d45.10 d50.45 d198.56 w45.67 The first entry is the account number; the remainder of the line, variable in length, contains all the transactions of the particular customer for the month: If the entry begins with a d, the number that follows is the amount of deposi If it begins with a w, the number that follows is the amount of withdraw. The customer "database" is stored in another file, accounts.txt which has entries of the form 123 daffy 34.67 where each line contains the customer's account number then their name, followed by the current account balance at the beginning of the month. Your program will write report in the following form ( given the above data ) Account Number : 123 Name : daffy Beginning Balance : $34.67 Ending Balance : $283.11 Amount Deposited : $294.11 Number of Deposits : 3 Amount Withdrawn : $45.67 Number of Withdraws : 1 The report is to be written to a file called account_report_MONTH.txt, where MONTH is a user entered month name CODE: Your program will read from the following files: a file containing the listing of all transactions for the month; a file containing a list of all customers, along with their account ids. You must use the following structure to hold the data of each customer: struct PersonAcct // struct account holds customer info { int acct_num; // customer account number string name; // customers name int acct_bal; // customers account balance }; Note: Feel free to construct your own files to test/debug you program Please provide a screenshot of where the file is located on the directory. Here are the two text files: accounts.txt 123 daffy 34.67 345 goofy 123.89 639 sneezy 1945.76 890 dopey 12345667.90 666 grumpy 666.66 transactions.txt 123 d45.10 d50.45 d198.56 w45.67 345 w34.00 d4.56 w45.13 d23.23 w23.12 639 d1000.34 d1234.56 w34.33 w345.87 w22.13 890 d345.67 d123.67 d45.99 d45.99 w34.77 666 d66.60 d666.66 d6.66 d66.6 d6666.66 Also specify the directory where the text files are save> for example C:DRIVE USE VISUAL STUDIO C++ Can someone provide a credible answer. Every other one is a fluke or a copy form google forum

Explanation / Answer

#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <cmath>
using namespace std;
struct account
{
string acctNum;          
string name;          
float cBal;          
float sBal
};
int menu();
char submenu();
int loadCustomers(account []);
void saveCustomers(account [], int);
int newCustomer(account [], int);
int deleteCustomer(account [], int);
int findCustomer(account [], int);
void deposit(account [], int);
void withdrawal(account [], int);
void balance(account [], int);
void bankBalance(account [], int);
int main()
{
account allAccounts[20];  
int customers;  
int menuChoice = 0;
customers = loadCustomers(allAccounts);
cout << "Loaded " << customers << " accounts." << endl;
system("pause");
do
{
menuChoice = menu();
if (menuChoice == 1)
{
newCustomer(allAccounts, customers);
}
if (menuChoice == 2)
{
deleteCustomer(allAccounts, customers);
}
/*
if (menuChoice == 3)
{
deposit(allAccounts, customers);
}

if (menuChoice == 4)
{
withdrawal(allAccounts, customers);
}
if (menuChoice == 5)
{
balance(allAccounts, customers);
}
if (menuChoice == 6)
{
bankBalance(allAccounts, customers);
}
*/
}
while (menuChoice != 7);
return 0;
}
int loadCustomers(account arr[])
{
int count = 0;
ifstream inFile;
string junk;
inFile.open("customer.dat");
if (!inFile)
cout << "Unable to open data file. " << endl;
else
{
getline(inFile, arr[count].acctNum, '#');
while (!inFile.eof())
{
getline(inFile, arr[count].name, '#');
inFile >> arr[count].cBal;
inFile.ignore();
inFile >> arr[count].sBal;
count++;
getline(inFile, arr[count].acctNum, '#');
}
}
return count;
}
int menu()
{
int choice;
system("cls");
cout << "*** Main Menu ***" << endl;
cout << "=================" << endl;
cout << "1. New Account" << endl;
cout << "2. Delete Account" << endl;
cout << "3. Deposit" << endl;
cout << "4. Withdrawal" << endl;
cout << "5. Balance" << endl;
cout << "6. Bank Balance" << endl;
cout << "7. Exit" << endl;
cout << " Enter Choice: ";
cin >> choice;
while (choice < 1 || choice > 7)
{
cout << "Invalid menu choice. Please select 1-7. "
<< "Enter Choice: ";
cin >> choice;
}
return choice;
}
int newCustomer(account arr[], int customers)
{
system("cls");
cout << "New Customer "
<< "============ "
<< "Enter Account Number: ";
cin >> arr[customers].acctNum;
cin.sync();
cout << "Enter Name: ";
getline(cin, arr[customers].name);
cin.sync();
arr[customers].cBal = 0.00;
arr[customers].sBal = 0.00;
customers++;
saveCustomers(arr, customers);
system("pause");
return customers;
}
int deleteCustomer(account arr[], int customers)
{
string numberAccount;
int i;
cin.sync();
cout << "Enter Account Number: ";
getline(cin, numberAccount);
for (i=0; i<customers; i++)
{
if (arr[i].acctNum == numberAccount)
{
for(int i=j; j<(customers-1); j++)
{
arr[i] = arr[j+1];
}
}
customers--;
break;
}
system("pause");
saveCustomers(arr, customers);
return customers;
}
void saveCustomers(account arr[], int customers)
{
ofstream outFile;
outFile.open("customer.dat");
for (int i=0; i<customers; i++)
{
outFile << arr[i].acctNum << "#" << arr[i].name << "#" << arr[i].cBal << "#" << arr[i].sBal << endl;
}
outFile.close();
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote