Additions to Phase 1
Transactions
Each account stores transactions information (the type of transaction (e.g. withdrawal, deposit …etc), the amount, the time of transaction and any additional information you think is important). When any transaction occurs this transaction is recorded in the account. So each account has more than one transaction. You should enable printing a report of a transactions performed on an account.
Standing orders
In addition each account contains a number of standing orders .Standing orders store the following information (the day of the month which it is paid, the regular amount to be paid and to whom the SO is payable). You should enable adding, deleting and processing a standing order. Processing an SO means checking if the day of the month is today, if it is, then withdraws the amount from the account and recording this as a transaction. You should enable processing standing orders for all accounts.
Account Types
Extend account so that there will be two types of accounts
o Personal account
o When the account is overdrawn there is a charge of $10 .
o Company account
o On each withdrawal, or deposit there is a charge of 5 cent.
phase 1
Implement a system for a bank. Design it so it can be used by the bank’s staff. It should enable the following:
o Opening a new account for a customer
o Closing an account
o Displaying all accounts
An Account
o Contains the name of the customer
o Contains the account balance.
o Enables withdrawal from the account
o Enables depositing to the account
the solve of phase1
/*THIS CODE IS A CODE FOR BANK SYSTEM WICH ALLOW THE COSTEMER TO OPEN A NEW ACCOUNT , CLOSE ACCOUNT , DEPOSIT,
WITHDRAW , SHOW ACCOUNT INFORMATION*/
#include <iostream>
#include <conio.h>
#include <stdlib.h>
using namespace std;
using std::fixed;
class Customer {//BEGIN OF THE CLASS
private:
char name[20];
char address[30];
char city[20];
char pcode[6];
double acc_bal;
double zak;
public:
Customer:: Customer() { // CONSTRUCTOR
acc_bal = 0.00;
}
void getdata();
void close_account();
void deposit();
void withdraw();
void showdata();
};//END OF CLASS
/////////OPEN ACCOUNT////////////
void Customer:: getdata() {
cout << "\nEnter your name: "; cin >> name;
cout << "\nEnter your address: "; cin >> address;
cout << "\nEnter your city: "; cin >> city;
cout << "\nEnter your postal code: "; cin >> pcode;
cout << "\nEnter current account balance: "; cin >> acc_bal;
}
////////CLOSE ACCOUNT///////////
void Customer::close_account()
{
int i;
i=0;
name[i]='\0';
address[i]='\0';
city[i]='\0';
pcode[i]='\0';
acc_bal=0.00;
cout<<"Thanks for using our bank"<<endl;
}
/////////DEPOSIT////////////
void Customer::deposit() {
float dep;
cout << "\nEnter amount to be deposited: ";
cin >> dep;
acc_bal += dep;
}
/////////WITHDRAW////////////
void Customer::withdraw() {
float wdraw;
cout << "\nEnter amount to be withdrawn: "; cin >> wdraw;
acc_bal -= wdraw;
}
/////////DISPLAY ACCOUNT////////////
void Customer::showdata()
{
cout << "Name: " << name;
cout << "\nAddress: " << address;
cout << "\nCity: " << city;
cout << "\nPostal Code: " << pcode;
cout << "\nAccount Balance: " << acc_bal<<"S.R."<< endl;
}
//////////////////MAIN///////////////
int main() {
char choice;
bool flag =0;
int count = 0;
int recnum;
Customer cust[10];
//////////////////MENU///////////////
while (flag == false) {
cout << "\t\t\n\n" << "Main Menu";
cout << "\t\n\n" << "Select by letter:";
cout << "\t\n" << "o - open new account.";
cout << "\t\n" << "d - Deposit money.";
cout << "\t\n" << "w - Withdraw money.";
cout << "\t\n" << "s - Show Account Information.";
cout << "\t\n" << "c _ close account.";
cout << "\t\n" << "q - Quit Application.\n\n";
cout << "\t" << "Choice: ";
cin>>choice ;
// END OF THE MENU
cout<<fixed;
switch(choice) {
case 'o':
system("cls");
if (count > 10) {
cout << "Can't add anymore records. Press any key to return to main menu.";
getche();
break;
}
count += 1;
cust[count].getdata();
system("cls");
break;
case 'd':
system("cls");
cout << "\nEnter customer number: ";
cin >> recnum;
cust[recnum].deposit();
system("cls");
break;
case 'w':
system("cls");
cout << "\nEnter customer number: ";
cin >> recnum;
cust[recnum].withdraw();
system("cls");
break;
case 'z':
system("cls");
cout << "\nEnter customer number: ";
cin >> recnum;
cust[recnum].zakat();
getche();
system("cls");
break;
case 's':
system("cls");
cout << "\nEnter customer number: ";
cin >> recnum;
cust[recnum].showdata();
getche();
system("cls");
break;
case 'n':
system("cls");
cout << "\nEnter customer number: ";
cin >> recnum;
cust[recnum].zakat_account();
getche();
system("cls");
break;
case 'c':
system("cls");
cout << "\nEnter customer number: ";
cin >> recnum;
cust[recnum].close_account();
getche();
system("cls");
break;
case 'q':
flag = 1;
break;
default:
cout << "\nInvalid selection. Press a key to return to main menu.";
getche();
}
if (flag == true) {
break;
}
}
return 0;
}
// END MAIN