This is my homework: Problem Statement: Write a C++ program that reads customers
ID: 3632452 • Letter: T
Question
This is my homework:Problem Statement: Write a C++ program that reads customers’ checking account information from dat files and calculate their account balance. In particular, a menu-based application should be developed to perform the following functions iteratively until the user request to quit the program.
1. Display the account summary: This option asks the user for the customer id, reads the customer’s dat file and displays the information on the consol with the total account balance.
2. Deposit the amount into the account: This option asks the user for the customer id, reads the customer’s dat file, adds the requested amount to the balance, and saves the file.
3. Withdraw the amount from the account: this option asks the user for the customer id, reads the customer’s dat file, verifies that the requested withdrawal is less than the account balance and then subtracts the requested amount from the balance, and saves the file. In case, if the requested withdrawal is greater than the account balance, the program should display an error message and terminate the transaction.
4. Quit the program: This option terminates the program.
Four test files are provided to test your program. The dat files are named based on the customer id. For instance, the customer of the bank is the author of the book, Tony Gaddis and his customer id is Cust_001. The dat file of his checking account is Cust_001.txt. The bank has only 999 customers with customer id Cust_001 to Cust_999.
This is what I have so far. I don't know how to create the dat files and I don't know when to display the menu and ask the choice. Do I need the function calls and when do I use them.
////Homework 3
//
////This program reads customers' checking account information
////from dat files and calculate their account balance.
////Also, this program provides a menu-based application.
//
////Ketrisa Foley
//
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
//Function Prototypes.
void menu();
void account_Summary();
void deposit();
void withDraw();
int main()
{
ifstream inputFile;
string customer_ID;
int number;
int choice;
//Get the customer id from the user.
cout << "Enter your customer id: ";
cin >> customer_ID;
//Open the customer's account.
inputFile.open("CustomersInfo.txt");
//Display the menu and get a choice.
cout << " 1. Account Summary "
<< " 2. Depost "
<< " 3. Withdraw "
<< " 4. Quit the program "
<< " Enter your account info " << endl;
cin >>
//The customer choice.
switch(choice)
{
case 1: account_Summary(); break;
case 2: deposit(); break;
case 3: withDraw(); break;
case 4: exit(0);
default: cout<<"Invaid chice ";
}
//Display the customer's account information.
if (customer_ID >=1 && customer_ID <=999)
{
cout << account_Summary << endl;
else
{
cout << "Invaid account information "
<< "Enter your customer id: ";
cin >> customer_ID;
}
return 0;
}
Explanation / Answer
#include #include #include using namespace std; void menu() { coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.