Bank Accounting System C++ PROGRAMING Develop a bank account transaction process
ID: 3739441 • Letter: B
Question
Bank Accounting System C++ PROGRAMING
Develop a bank account transaction processing system. This software is the basis for the software that would be used by a bank to manage user accounts. When developing the interface, you should imagine the interactions between a bank teller and a customer.
There are two main programs in this assignment. 1) teller_simulation, and 2) ReportGeneration.
Teller Simulation
The first program simulates a bank teller that customers would interact with to create accounts, deposit, or withdraw funds. The following dialog is one possible set of interactions that your software system must provide interfaces for:
Teller: Hello, Let's make a new account for you. CustomerRecord: My name is "Wade Wilson", I live at "201 14th Street, Seattle Washington, 91312", and I my social security number is "SSN_9999"
Teller: Thank you! Now that you are a member of our bank, can we open an account? For you?
CustomerRecord: Yes please. Please create both a checking account, and a saving account associated with my SSN.
Teller: You two accounts are created with zero balance. Would you like to make a deposit?
CustomerRecord: Please makeDeposit of $57 in my checking account.
CustomerRecord: Please makeDeposit $77 in my savings account.
Teller: Would you like to make a withdrawal?
CustomerRecord: Yes, makeWithdrawal of $100 from my savings account.
Teller: Sorry, you have insufficient funds to perform that task, your acount was not modified.
At the beginging of each day when the bank accounting program starts, all previous customer transactions are read in from a file on disk.
At the end of the day when the program ends, the entire transaction history needs to be written to disk.
Report Generation
The second program reads a transaction history file (provided to the program as argv[1]), and generates a report of each customers account balances.
GENERAL RULES:
All users need a name with more than 5 characters in their name.
CustomerSSN's must be unique (no two customers can have the same SSN)
Only 1 bank object can be used.
ZipCode must have exactly 5 digits.
State must be exactly 2 characters (bonus, validate only valid states).
All public interface itmes must be justified. Many private attributes will not have public getters/setters.
You are allowed to use std::cerr only for error processing.
Address - Has Street - Has City - Has State - Has ZipCode Bank + Must be able to add a customer (and validate rules) + Must be able to change addresses + Must be able to verify that a customer exists (HasCustomer based on SSN). - Has many Customers - Has RoutingBankID (Can never be changed after bank is created) (RountingBankIDK always begins with the letter 'R') - Has Bank Name (Can never be changed after bank is created) - Has Address HINT: Some attributes will NOT have public geters/setters; HINT: maps need : object of type 'Bank' cannot be assigned because its copy assignment operator is implicitly deleted mapOfAllBanks[routingNumber] = myBank; ^ /Users/johnsonhj/cie/ENGR2730Private/homework/homework4/exampleSolution/Bank.h:41:21: note: copy assignment operator of 'Bank' is implicitly deleted because field 'm_RoutingBankID' has no copy assignment operator const std::string m_RoutingBankID; ^ CustomerRecord + Must be able to create a new account ledger for Checking/Savings/ or Loan acocunts. Error checking must be available to check if an account already exists. - Has Address - Has CustomerRecord Name - Has Accounts (You may assume that a customer has at most 1 each type of account, but you may *not* assume that a customer has all accounts) - Has CustomerSSN (Can never be changed after customer is created) CustomerSSN (Always begins with letter 'S') AccountLedger + Must be able to make deposits (verified that only non-negative values are requested to be deposited). Invalid request result in error message but no transaction recorded. Deposits must optionally be annotated with a memo Timestamps for new transactions need to be timestamped with "chrono" + Must be able to make withdrawls (verified that non-negative values accepted to be withdrawn), Must verify that sufficient funds are available to make the withdrawal. Invalid request result in error message but no transaction recorded. Internal to the class, the value stored will be negated to indicate a reduction in the balance. Withdrawals must optionally be annotated with a memo + Must be able to compute the balance of the account as needed. The balance MUST NOT BE STORED, it must be computed from the list of transactions. - AccountLedger Type [Checking|Savings|Loan] - List of transactions Transaction - Change value - Date/Time (use time_t which is an integer representing # of seconds past a given epoch time)
HINTS:
m_AccountMapping[type] = AccountLedger(type);
This requires 3 functions to complete: m_AccountMapping[type] --> Needs AccountLedger() = --> needs operator=(....) AccountLedger(type) --> Needs AccountLedger( AccountType )
Use typedefs judiciously in this assignment.
NameType --> std::string, or ??
SSNType --> std::string or char *, or class?
StreetNameType --> std::string, or ?? ZipCodeType --> (int, or string, or float, or something else)
Having a record like the following is not acceptable:
"","",""","","","""
any help and/or suggestions on how to do aspects of this would be greatly appreciated, I'm not looking for the full code, I am having alot of trouble with the class structures and interface, MUST BE IN C++.
Explanation / Answer
here the code for the banking account system
#include<iostream>
#include<fstream>
#include<cctype>
#include<iomanip>
using namespace std;
class account
{
int accnum;
char name[50];
int depositosit;
char type;
public:
void createAcc();
void showAcc() const;
void modify();
void deposit(int);
void draw(int);
void report() const;
int retaccnum() const;
int retdepositosit() const;
char rettype() const;
};
void account::createAcc()
{
cout<<" Enter The account No. :";
cin>>accnum;
cout<<" Enter The Name of The account Holder : ";
cin.ignore();
cin.getline(name,50);
cout<<" Enter Type of The account (C/S) : ";
cin>>type;
type=toupper(type);
cout<<" Enter The Initial amount(>=500 for Saving and >=1000 for current ) : ";
cin>>depositosit;
cout<<" Account Created..";
}
void account::showAcc() const
{
cout<<" Account No. : "<<accnum;
cout<<" Account Holder Name : ";
cout<<name;
cout<<" Type of Account : "<<type;
cout<<" Balance amount : "<<depositosit;
}
void account::modify()
{
cout<<" Account No. : "<<accnum;
cout<<" Modify Account Holder Name : ";
cin.ignore();
cin.getline(name,50);
cout<<" Modify Type of Account : ";
cin>>type;
type=toupper(type);
cout<<" Modify Balance amount : ";
cin>>depositosit;
}
void account::deposit(int x)
{
depositosit+=x;
}
void account::draw(int x)
{
depositosit-=x;
}
void account::report() const
{
cout<<accnum<<setw(10)<<" "<<name<<setw(10)<<" "<<type<<setw(6)<<depositosit<<endl;
}
int account::retaccnum() const
{
return accnum;
}
int account::retdepositosit() const
{
return depositosit;
}
char account::rettype() const
{
return type;
}
void write_account();
void display_sp(int);
void modify_account(int);
void delete_account(int);
void display_all();
void depositosit_withdraw(int, int);
void intro();
int main()
{
char ch;
int num;
intro();
do
{
system("cls");
cout<<" MAIN MENU";
cout<<" 01. NEW ACCOUNT";
cout<<" 02. DEPOSIT AMOUNT";
cout<<" 03. WITHDRAW AMOUNT";
cout<<" 04. BALANCE ENQUIRY";
cout<<" 05. ALL ACCOUNT HOLDER LIST";
cout<<" 06. CLOSE AN ACCOUNT";
cout<<" 07. MODIFY AN ACCOUNT";
cout<<" 08. EXIT";
cout<<" Select Your Option (1-8) ";
cin>>ch;
system("cls");
switch(ch)
{
case '1':
write_account();
break;
case '2':
cout<<" Enter The account No. : "; cin>>num;
depositosit_withdraw(num, 1);
break;
case '3':
cout<<" Enter The account No. : "; cin>>num;
depositosit_withdraw(num, 2);
break;
case '4':
cout<<" Enter The account No. : "; cin>>num;
display_sp(num);
break;
case '5':
display_all();
break;
case '6':
cout<<" Enter The account No. : "; cin>>num;
delete_account(num);
break;
case '7':
cout<<" Enter The account No. : "; cin>>num;
modify_account(num);
break;
case '8':
cout<<" Thanks for using bank managemnt system";
break;
default :cout<<"";
}
cin.ignore();
cin.get();
}while(ch!='8');
return 0;
}
void write_account()
{
account ac;
ofstream outFile;
outFile.open("account.dat",ios::binary|ios::app);
ac.createAcc();
outFile.write(reinterpret_cast<char *> (&ac), sizeof(account));
outFile.close();
}
void display_sp(int n)
{
account ac;
bool flag=false;
ifstream inFile;
inFile.open("account.dat",ios::binary);
if(!inFile)
{
cout<<"File could not be open !! Press any Key...";
return;
}
cout<<" BALANCE DETAILS ";
while(inFile.read(reinterpret_cast<char *> (&ac), sizeof(account)))
{
if(ac.retaccnum()==n)
{
ac.showAcc();
flag=true;
}
}
inFile.close();
if(flag==false)
cout<<" Account number does not exist";
}
void modify_account(int n)
{
bool found=false;
account ac;
fstream File;
File.open("account.dat",ios::binary|ios::in|ios::out);
if(!File)
{
cout<<"File could not be open !! Press any Key...";
return;
}
while(!File.eof() && found==false)
{
File.read(reinterpret_cast<char *> (&ac), sizeof(account));
if(ac.retaccnum()==n)
{
ac.showAcc();
cout<<" Enter The New Details of account"<<endl;
ac.modify();
int pos=(-1)*static_cast<int>(sizeof(account));
File.seekp(pos,ios::cur);
File.write(reinterpret_cast<char *> (&ac), sizeof(account));
cout<<" Record Updated";
found=true;
}
}
File.close();
if(found==false)
cout<<" Record Not Found ";
}
void delete_account(int n)
{
account ac;
ifstream inFile;
ofstream outFile;
inFile.open("account.dat",ios::binary);
if(!inFile)
{
cout<<"File could not be open !! Press any Key...";
return;
}
outFile.open("Temp.dat",ios::binary);
inFile.seekg(0,ios::beg);
while(inFile.read(reinterpret_cast<char *> (&ac), sizeof(account)))
{
if(ac.retaccnum()!=n)
{
outFile.write(reinterpret_cast<char *> (&ac), sizeof(account));
}
}
inFile.close();
outFile.close();
remove("account.dat");
rename("Temp.dat","account.dat");
cout<<" Record Deleted ..";
}
void display_all()
{
account ac;
ifstream inFile;
inFile.open("account.dat",ios::binary);
if(!inFile)
{
cout<<"File could not be open !! Press any Key...";
return;
}
cout<<" ACCOUNT HOLDER LIST ";
cout<<"A/c no. NAME Type Balance ";
while(inFile.read(reinterpret_cast<char *> (&ac), sizeof(account)))
{
ac.report();
}
inFile.close();
}
void depositosit_withdraw(int n, int option)
{
int amt;
bool found=false;
account ac;
fstream File;
File.open("account.dat", ios::binary|ios::in|ios::out);
if(!File)
{
cout<<"File could not be open !! Press any Key...";
return;
}
while(!File.eof() && found==false)
{
File.read(reinterpret_cast<char *> (&ac), sizeof(account));
if(ac.retaccnum()==n)
{
ac.showAcc();
if(option==1)
{
cout<<" TO DEPOSITE AMOUNT ";
cout<<" Enter The amount to be depositosited";
cin>>amt;
ac.deposit(amt);
}
if(option==2)
{
cout<<" TO WITHDRAW AMOUNT ";
cout<<" Enter The amount to be withdraw";
cin>>amt;
int bal=ac.retdepositosit()-amt;
if((bal<500 && ac.rettype()=='S') || (bal<1000 && ac.rettype()=='C'))
cout<<"Insufficience balance";
else
ac.draw(amt);
}
int pos=(-1)*static_cast<int>(sizeof(ac));
File.seekp(pos,ios::cur);
File.write(reinterpret_cast<char *> (&ac), sizeof(account));
cout<<" Record Updated";
found=true;
}
}
File.close();
if(found==false)
cout<<" Record Not Found ";
}
void intro()
{
cout<<" BANK";
cout<<" MANAGEMENT";
cout<<" SYSTEM";
cout<<" MADE BY : your name";
cout<<" SCHOOL : your school name";
cin.get();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.