Bank Account Management
#include <iostream>
#include <conio.h>
using namespace std;
class account
{
char cust_name[20];
int acc_no;
char acc_type;
public:
void get_account_info()
{
cout << "\n\n\n";
cout << "\t\t*********************************\n";
cout << "\t\t*********************************\n";
cout << "\t\tEnter Customer Name :- ";
cin >> cust_name;
cout << "\t\tEnter Account Number :- ";
cin >> acc_no;
cout << "\t\tEnter Account Type :- ";
cin >> acc_type;
cout << "\t\t*********************************\n";
cout << "\t\t**********************************\n";
}
void display_acc_info()
{
cout << "\n\n";
cout << "\t\t+++++++++++++++++++++++++++++++++\n";
cout << "\t\t+++++++++++++++++++++++++++++++++\n";
cout << "\t\tCustomer Name :- " << cust_name << endl;
cout << "\t\tAccount Number :- " << acc_no << endl;
cout << "\t\tAccount Type :- " << acc_type << endl;
}
};
class current_account : public account
{
static float balance;
public:
void display_current_balance()
{
cout << "\t\tBalance :- " << balance << endl;
cout << "\t\t+++++++++++++++++++++++++++++++++\n";
cout << "\t\t+++++++++++++++++++++++++++++++++\n";
}
void deposite_current_balance()
{
float deposit;
cout << "\n\t\tEnter amount to Deposit :- ";
cin >> deposit;
balance = balance + deposit;
}
void withdraw_current_balance()
{
float penalty,withdraw;
cout << "\n\n\t\tBalance :- " << balance;
cout << "\n\t\tEnter amount to be withdraw :- ";
cin >> withdraw;
balance = balance - withdraw;
if(balance < 500)
{
penalty = (500 - balance)/10;
balance = balance - penalty;
cout << "\n\t\tBalance after detecting penalty :- " << balance;
}
else if(withdraw > balance)
{
cout << "\n\n\t\tYou have to take permission for Bank Overdraft
facility\n ";
balance = balance + withdraw;
}
else
cout << "\n\t\tAfter withdraw your Balance revels : " << balance;
}
};
class saving_account : public account
{
static float saving_balance;
public:
void display_saving_balance()
{
cout << "\t\tBalance :- " << saving_balance;
cout << "\n\t\t+++++++++++++++++++++++++++++++++\n";
cout << "\t\t+++++++++++++++++++++++++++++++++\n";
}
void deposit_saving_balance()
{
float deposit,interest;
cout << "\n\t\tEnter amount to Deposit :- ";
cin >> deposit;
saving_balance = saving_balance + deposit;
interest = (saving_balance*2)/100;
saving_balance = saving_balance + interest;
}
void withdraw_saving_balance()
{
float withdraw;
cout << "\n\t\tBalance :- " << saving_balance;
cout << "\n\t\tEnter amount to be withdraw :- ";
cin >> withdraw;
saving_balance = saving_balance - withdraw;
if(withdraw > saving_balance)
{
cout << "\n\n\t\tYou have to take permission for Bank Overdraft facility\n
";
saving_balance = saving_balance + withdraw;
}
else
cout << "\n\t\tAfter withdraw your Balance revels :- " << saving_balance;
}
};
float current_account :: balance;
float saving_account :: saving_balance;
int main()
{
cout << "\n\n\n\t\t************Account Management
System************\n\n\n";
cout << "\t\t\t\t*\t*";
cout << "\n\t\t\t\t**\t**";
cout << "\n\t\t\t\t***\t***";
cout << "\n\t\t\t\t****\t****";
cout << "\n\t\t\t\t*****\t*****";
cout << "\n\t\t\t\t******\t******";
cout << "\n\t\t\t\t*******\t*******";
cout << "\n\t\t\t\t****************";
cout << "\n\t\t\t\t*******\t*******";
cout << "\n\t\t\t\t******\t******";
cout << "\n\t\t\t\t*****\t*****";
cout << "\n\t\t\t\t****\t****";
cout << "\n\t\t\t\t***\t***";
cout << "\n\t\t\t\t**\t**";
cout << "\n\t\t\t\t*\t*\n";
current_account c1;
saving_account s1;
char type;
cout <<
"\n\n\t\t=====================================================
================\n";
cout << "\t\tEnter S for saving customer and C for current a/c customer :- "; cin
>> type;
cout <<
"\t\t========================================================
=============\n";
int choice;
if(type == 's' || type == 'S')
{
s1.get_account_info();
while(1)
{
cout << "\n\n\t\t******For Saving a/c Customers******";
cout <<
"\n\t\t@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\
n";
cout << "\t\t1) Deposit\n";
cout << "\t\t2) Withdraw\n";
cout << "\t\t3) Display Balance\n";
cout << "\t\t4) Display with full Details\n";
cout << "\t\t5) Exit\n";
cout <<
"\t\t@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n";
cout << "\t\tChoose your choice... ";
cin >> choice;
switch(choice)
{
case 1:
s1.deposit_saving_balance();
getch();
break;
case 2:
s1.withdraw_saving_balance();
getch();
break;
case 3:
s1.display_saving_balance();
getch();
break;
case 4:
s1.display_acc_info();
s1.display_saving_balance();
getch();
break;
case 5:
goto end;
default:
cout << "\n\nEntered choice is invalid, \"TRY AGAIN\" " ;
}
}
}
else
{
c1.get_account_info();
while(1)
{
cout << "\n\n\t\t******For Current a/c Customers******\n";
cout <<
"\t\t@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n";
cout << "\t\t1) Deposit\n";
cout << "\t\t2) Withdraw\n";
cout << "\t\t3) Display Balance\n";
cout << "\t\t4) Display with full Details\n";
cout << "\t\t5) Exit\n";
cout <<
"\t\t@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n";
cout << "\t\tChoose your choice... :- ";
cin >> choice;
switch(choice)
{
case 1:
c1.deposite_current_balance();
getch();
break;
case 2:
c1.withdraw_current_balance();
getch();
break;
case 3:
c1.display_current_balance();
getch();
break;
case 4:
c1.display_acc_info();
c1.display_current_balance();
getch();
break;
case 5:
goto end;
default:
cout << "\n\nEntered choice is invalid, \"TRY AGAIN\" " ;
}
}
}
end:
getch();
return 0;
}