Banking System This system tracks customers’ accounts in a bank, The system prov
ID: 3635041 • Letter: B
Question
Banking System
This system tracks customers’ accounts in a bank, The system provides the following
functionalities: Add a new account, withdraw, deposit, display the account.
The system interface has an interface like the following:
Welcome to our Banking System
You can do one of the following actions using this banking system:
1. Add a new account
2. Withdraw from the account
3. Deposit to the account
4.Display the account information
5. Display total of the customers’ balances
6.Exit
Explation
When the user chooses 1, the system generates a new ID, and then asks the user to enter a name for that account. The initial balance is set to zero.
When the user chooses 2, the system asks the user to enter account ID and amount to be withdrawn. If this amount is greater than the balance, a message is displayed that this transaction failed because insufficient balance. If balance is enough, it decreases by amount to be withdrawn.
When the user chooses 3. The system asks the user to enter account ID and amount to be deposited. System increases balance by this amount.
When the user chooses 4, the system asks the user to enter account ID then prints account’s name and balance.
Each time a task is completed the system gets back to the main menu above until the user chooses 5.
Hints:
Implement the choices in the menu as functions in your program, even the menu itself.
Arrays should be used.
Your system should use file to retrieve previous data ( if exist) each time it starts. When the user chooses to exit the program, the data should be saved in the same file.
Explanation / Answer
Dear, /*This program compiled using Visual C++ 2010. Include stdafx.h header file to compile in Visual C++ 2010*/ /*Program to simulate bank operations. Stores the back up data in a file*/ //header files //#include "stdafx.h" #include //needed for I/O operations #include //needed for string operations #include //needed for file operations //pre defined constant for maximum number of accounts #define MAX 10 using namespace std; //class Bank class Bank { //member variables to hold data of customers and their accounts private: string name[MAX]; int acno[MAX]; double balance[MAX]; int autoacno; //member functions to do bank operations public: Bank(); void newAccount(); void withdraw(); void deposit(); void getBalance(); void displayDetails(); int menu(); ~Bank(); }; //constructor - this method is automatically when the Bank //object is created Bank::Bank() { //variable to hold input file ifstream infile; //opening a files infile.open("backup.txt"); // checking the backup file existence if (!infile.is_open()) { cout>acno[i]; infile>>balance[i]; } } //close the file infile.close(); } } //destructor - automatically called when returned from the main function Bank::~Bank() { //variable to hold output file ofstream outfile; //opening a files outfile.open("backup.txt"); //writing the data to the file outfileRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.