Question

In: Computer Science

In this project, we will make up a banking system. You are an employee of MadeUp...

In this project, we will make up a banking system. You are an employee of MadeUp Banking. Your job is to manage multiple bank accounts. Here, you would create new accounts, deposit to an account, withdraw from an account, delete account, sort the accounts, or do inspection on one or all bank accounts. In order to do this job, you would need the tool for each of those items. The bank maintains a list of accounts. This list has to be available as long as the bank is in business.

Write a program in C++ to run the MadeUp Banking business. As state above, the list of account has to be available as long as you run the program. This means the list of the account has to be initialized in the ​main()​ function. Write a function for each of the items above. You will call these functions to perform any task on the bank accounts. Each account will have account number, name (last, first), and balance. The ​header file​,​ function file​, and ​main file​ are as the sample below. ​All functions are of type ​void​. You will fill in the necessary function parameters.
In order to do this project, you would need to understand ​pointers​, ​functions​, and ​vectors among other basic C++ knowledge. You will follow the exact requirement and format of the program. Any unnecessary changes will result in points taken off.

Solutions

Expert Solution

The following is bank.cpp tested on Dev-C++ .

#include<iostream>
#include<fstream>   
#include<cctype>
#include<iomanip>
using namespace std;

//The Welcome Screen
void intro()
{
cout<<"\n\n\n\tWelcome To MadeUp Banking System";
cout<<"\nPress Enter To Continue........";
cin.get();
}

class acc
{
int ano;
char name[100];
int dep;
char type;
public:
void create_acc(); //function to create a new account
void show_acc() const; //function to show account details
void modify(); //function to modify account details
void adep(int); //function to accept deposit amount
void draw(int); //function to subtract withdrawal amount
void report() const; //function to show data in tabular format
int retano() const; //For returning account number
int retbal() const; //For returning balance amount
char qtype() const; //For returning type of account
}; //Class definition ends

void acc::create_acc()
{
cout<<"\nEnter The Account Number :";
cin>>ano;
cout<<"\n\nEnter, Name of The Account Holder : ";
cin.ignore();
cin.getline(name,100);
cout<<"\nEnter Type of Account(Current/Savings) : ";
cin>>type;
cout<<"\nEnter The Initial amount(>=500 for Saving and >=1000 for current ) : ";
cin>>dep; //We have set the minimum initial amount for savings be 500 & for current be 1000
cout<<"\n\n\nCongrats Account Has Been Created..";
}

void acc::show_acc() const
{
cout<<"\nAccount Number : "<<ano;
cout<<"\nAccount Holder Name : ";
cout<<name;
cout<<"\nType of Account : "<<type;
cout<<"\nBalance amount : "<<dep;
}


void acc::modify()
{
cout<<"\nAccount Number : "<<ano;
cout<<"\nModify Account Holder Name : ";
cin.ignore();
cin.getline(name,100);
cout<<"\nModify Type of Account : ";
cin>>type;
cout<<"\nModify Balance amount : ";
cin>>dep;
}

void acc::adep(int x)
{
dep+=x;
}
  
void acc::draw(int x)
{
dep-=x;
}
  
void acc::report() const
{
cout<<ano<<setw(10)<<" "<<name<<setw(10)<<" "<<type<<setw(6)<<dep<<endl;
}
  
int acc::retano() const
{
return ano;
}

int acc::retbal() const
{
return dep;
}

char acc::qtype() const
{
return type;
}

void write_acc(); //function to write record in binary file
void display_sp(int); //function to display account details given by user
void modify_acc(int); //function to modify record of file
void delete_acc(int); //function to delete record of file
void display_all(); //function to display all account details
void dep_withdraw(int, int); // function to desposit/withdraw amount for given account
void intro(); //introductory screen function

int main()
{
char ch;
int num;
intro();
do
{
  
cout<<"\n\n\n\tACTION MENU";
cout<<"\n\n\t01. NEW ACCOUNT";
cout<<"\n\n\t02. DEPOSIT";
cout<<"\n\n\t03. WITHDRAW";
cout<<"\n\n\t04. BALANCE ENQUIRY";
cout<<"\n\n\t05. COMPLETE ACCOUNT HOLDERS LIST";
cout<<"\n\n\t06. CLOSE AN ACCOUNT";
cout<<"\n\n\t07. MODIFY AN ACCOUNT";
cout<<"\n\n\t08. EXIT";
cout<<"\n\n\tSelect Your Option (1-8) ";
cin>>ch;
  
switch(ch)
{
case '1':
write_acc();
break;
case '2':
cout<<"\n\n\tEnter The Account Number : "; cin>>num;
dep_withdraw(num, 1);
break;
case '3':
cout<<"\n\n\tEnter The Account Number : "; cin>>num;
dep_withdraw(num, 2);
break;
case '4':
cout<<"\n\n\tEnter The Account Number : "; cin>>num;
display_sp(num);
break;
case '5':
display_all();
break;
case '6':
cout<<"\n\n\tEnter The Account Number : "; cin>>num;
delete_acc(num);
break;
case '7':
cout<<"\n\n\tEnter The Account Number : "; cin>>num;
modify_acc(num);
break;
case '8':
cout<<"\n\n\tThanks For Visiting Our Bank!";
break;
default :cout<<"\a";
}
cin.ignore();
cin.get();
}while(ch!='8');
return 0;
}// Function To write the account data to .dat file
void write_acc()
{
acc ac;
ofstream x;
x.open("info.dat",ios::binary|ios::app);
ac.create_acc();
x.write(reinterpret_cast<char *> (&ac), sizeof(acc));
x.close();
}


void display_sp(int n) //function to retrive a record from file stored
{
acc ac;
bool flag=false;
ifstream x;
x.open("info.dat",ios::binary);
if(!x)
{
cout<<"File could not be opened!! Press any Key to exit...";
return;
}
cout<<"\nBALANCE DETAILS\n";

while(x.read(reinterpret_cast<char *> (&ac), sizeof(acc)))
{
if(ac.retano()==n)
{
ac.show_acc();
flag=true;
}
}
x.close();
if(flag==false)
cout<<"\n\nAccount number does not exist";
}//function to modify record of an account which is stored in file
void modify_acc(int n)
{
bool found=false;
acc ac;
fstream x;
x.open("info.dat",ios::binary|ios::in|ios::out);
if(!x)
{
cout<<"File could not be open !! Press any Key...";
return;
}
while(!x.eof() && found==false)
{
x.read(reinterpret_cast<char *> (&ac), sizeof(acc));
if(ac.retano()==n)
{
ac.show_acc();
cout<<"\n\nEnter The New Details of account"<<endl;
ac.modify();
int pos=(-1)*static_cast<int>(sizeof(acc));
x.seekp(pos,ios::cur);
x.write(reinterpret_cast<char *> (&ac), sizeof(acc));
cout<<"\n\n\t Record Updated";
found=true;
}
}
x.close();
if(found==false)
cout<<"\n\n Record Not Found ";
}//function to delete a record from file
void delete_acc(int n)
{
acc ac;
ifstream x;
ofstream y;
x.open("info.dat",ios::binary);
if(!x)
{
cout<<"File could not be open !! Press any Key...";
return;
}
y.open("Temp.dat",ios::binary);
x.seekg(0,ios::beg);
while(x.read(reinterpret_cast<char *> (&ac), sizeof(acc)))
{
if(ac.retano()!=n)
{
y.write(reinterpret_cast<char *> (&ac), sizeof(acc));
}
}
x.close();
y.close();
remove("info.dat");
rename("Temp.dat","info.dat");
cout<<"\n\n\tRecord Deleted ..";
}// function to display account details from the stored file
void display_all()
{
acc ac;
ifstream x;
x.open("info.dat",ios::binary);
if(!x)
{
cout<<"File could not be open !! Press any Key...";
return;
}
cout<<"\n\n\t\tACCOUNT HOLDER LIST\n\n";
cout<<"====================================================\n";
cout<<"A/c no. NAME Type Balance\n";
cout<<"====================================================\n";
while(x.read(reinterpret_cast<char *> (&ac), sizeof(acc)))
{
ac.report();
}
x.close();
}// function to withdraw amout from the account
void dep_withdraw(int n, int option)
{
int amt;
bool found=false;
acc ac;
fstream x;
x.open("info.dat", ios::binary|ios::in|ios::out);
if(!x)
{
cout<<"File could not be open !! Press any Key...";
return;
}
while(!x.eof() && found==false)
{
x.read(reinterpret_cast<char *> (&ac), sizeof(acc));
if(ac.retano()==n)
{
ac.show_acc();
if(option==1)
{
cout<<"\n\n\tTO DEPOSITE AMOUNT ";
cout<<"\n\nEnter The amount to be deposited";
cin>>amt;
ac.adep(amt);
}
if(option==2)
{
cout<<"\n\n\tTO WITHDRAW AMOUNT ";
cout<<"\n\nEnter The amount to be withdraw";
cin>>amt;
int bal=ac.retbal()-amt;
if((bal<500 && ac.qtype()=='S') || (bal<1000 && ac.qtype()=='C'))
cout<<"Insufficience balance";
else
ac.draw(amt);
}
int pos=(-1)*static_cast<int>(sizeof(ac));
x.seekp(pos,ios::cur);
x.write(reinterpret_cast<char *> (&ac), sizeof(acc));
cout<<"\n\n\t Record Updated";
found=true;
}
}
x.close();
if(found==false)
cout<<"\n\n Record Not Found ";
}

sample outputs:


Related Solutions

suppose we have a banking system in which the public chooses to make all of its...
suppose we have a banking system in which the public chooses to make all of its purchases by using checking deposits. in addition, banks desire to maximize the reserve ratio is 20% and the FED purchases $1,000,000 in treasury bills from bank 1. explain what happens to this bank (Bank 1) and two additional steps in the deposit expansion process based on the 20% reserve requirement. Put differently, what will be the change in deposits for the first bank (Bank1)...
Just Make up a project Pick a project with which you are familiar. It could be...
Just Make up a project Pick a project with which you are familiar. It could be the project you described in Chapter 1 or any other project. Briefly describe the project. Once you have provided an overview of the project develop a project scope statement. As described in the textbook, a project scope statement should contain the following items: Project objective Deliverables Milestones Technical requirements Limits and exclusions
What are the documentations of an online banking system for a project in software engineering
What are the documentations of an online banking system for a project in software engineering
How is money made? This is about the banking system, and how it works to “make”...
How is money made? This is about the banking system, and how it works to “make” money.  Please use words and examples or whatever you can.
Initially, the Republic of Gorgonzola has no commercial banking system. To make trading easier and eliminate...
Initially, the Republic of Gorgonzola has no commercial banking system. To make trading easier and eliminate the need for barter, the government directs the central bank of Gorgonzola to put into circulation 4,000,000 identical paper notes, called guilders. The central bank prints the guilders and distributes them to the people. At this point the Gorgonzolan money supply is 4,000,000 million guilders. In order to keep the money safe, some Gorgonzolan entrepreneurs set up a system of commercial banks. When people...
Scenario: Online banking, web banking or internet banking. Online banking is an electronic payment system that...
Scenario: Online banking, web banking or internet banking. Online banking is an electronic payment system that enables customers of banks to perform transactions online through the bank’s website. The online banking is part of the core banking system operated by a bank. Online banking services offer features such as view account balance, view bank monthly statements, download bank statements, check some recent transactions, pay bills (rent, cell recharge, internet, electricity, gas, etc. ), transfer money to another account. If you...
Q3. The banking system in Saudi Arabia is considered one of the most developed banking system...
Q3. The banking system in Saudi Arabia is considered one of the most developed banking system in the region, discuss this statement explaining the structure of that system explaining kinds of banks, Number of branches, numbers of ATM, ownership structure, size of banks measured by total assets and explain whether or not merger or acquisition transactions are required to improve performance through small number of banks with large branch networks instead of large number of banks with small branch networks...
In this activity, you will select a country and analyze the banking and financial system of...
In this activity, you will select a country and analyze the banking and financial system of that country. Locate a recent article (published within the last year) that discusses your selected country's banking and financial system. You can use the Hunt Library, newspapers, new stations, or other credible sources to locate an article. Analyze the article and then provide the following in your discussion. Analyze your chosen country's banking and financial systems. Describe how money is measured in your chosen...
Make up an Integrated Project Schedule for a car. (preferably electric car)
Make up an Integrated Project Schedule for a car. (preferably electric car)
1)Prior to the dual banking system, the U.S. banking system included: A.  National banks that used a...
1)Prior to the dual banking system, the U.S. banking system included: A.  National banks that used a national currency B.  A powerful central bank responsible for money and credit in the economy C.  a state banking system   C.  a state banking system 2)Financial innovation in the banking industry often occurs in response to changes in financial markets, the regulatory environment, or new technology. The following questions consider how banks respond to various conditions in the banking industry.   Money-market mutual funds allowed individuals to avoid...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT