In this program you can upload new bank accounts to the system and open a new account, view the details of your account, deposit money to your account and withdraw money from your account.
This is a simple C++ program for Banking. In this program a banking system has been created for a bank named Bank of Arizona. The program is implemented using OOPS concept (Class and Objects) and Switch case.
The program constitutes of the following Key attributes:
1. Uploading Accounts to the system
2. Open a new Account with the Bank
3. View the details of your existing account.
4. Deposit Money to your existing account.
5. Withdraw Money from your existing account.
#include using namespace std; class Bank_of_Arizona { private: //Private Class int account_no, balance_amt; char name[50], account_type[20]; public: //Public Class void createAccount() //Public Function to Create an Account { cout<<"\n Enter the Account Number: "; cin>>account_no; cout<<"\n Enter Account Holder Name: "; cin>>name; cout<<"\n Enter type of Account from Savings Account /Fixed Account: "; cin>>account_type; cout<<"\n Enter Balance (If you are creating a new account Enter 0): "; cin>>balance_amt; } void viewAccount() //Public Function to View the Details of the Account { cout<<"\n Account Number: "; cout<<account_no; cout<<"\n Account Holder Name: "; cout<<name; cout<<"\n Type of Account: "; cout<<account_type; cout<<"\n Your Current Balance: "; cout<<balance_amt; } void depositAmount() //Public Function to Deposit Money to Account { int amt; cout<<"\n Enter the amount that you want to Deposit to your Account: "; cin>>amt; balance_amt=balance_amt+amt; cout<<"\n Thank you the amount has been deposited "; } void withdrawAmount() //Public Function to Withdraw Money from Account { int amt; cout<<"\n Enter the amount that you want to Withdraw: "; cin>>amt; if (amt<=balance_amt) { balance_amt=balance_amt-amt; cout<<"\n Amount Withdrawn! Balance amount= "<<balance_amt; } else cout<<"\n The above Entered amount "<<amt<<" is not present in your account"<<"\n Your current balance is "<<balance_amt; } int Account(int); }; int Bank_of_Arizona :: Account(int n) //Search Account from Record { if(account_no==n) { viewAccount(); return 1; } return 0; } int main() //Main Function { int x, amt; char ch, opt; Bank_of_Arizona B[x]; int flag=0, n, i; cout<<"\n------------------------------------------------------------------------------------------------------------"; cout<<"\n\t\t\t\t\t\t BANK OF ARIZONA"; cout<<"\n------------------------------------------------------------------------------------------------------------"; cout<<"\n\n\t\t WELCOME TO BANK OF ARIZONA"; do{ cout<<"\n Enter number of Accounts to be added to the System:"; cin>>x; for(i=0;i<x;i++) { B[i].createAccount(); } cout<<"\n Select any one of the option listed below"; cout<<"\n1. Open a new Account"; cout<<"\n2. View the details of your Existing Account"; cout<<"\n3. Deposit money to your Existing Account"; cout<<"\n4. Withdraw money from your Existing Account"; cout<<"\n5. Exit"; cout<<"\n\t Please choose any option from 1-5:\t"; cin>>ch; switch(ch) { case '1': for(i=0;i<=x;i++) { B[i].createAccount(); } break; case '2': for(i=0;i<=x;i++) { B[i].viewAccount(); } break; case '3': cout<<"\n Enter the Account Number to which the Amount has to be Deposited: "; cin>>n; for(i=0;i<=x;i++) { flag=B[i].Account(n); if(flag) { B[i].depositAmount(); break; } } if(!flag) { cout<<"\n Invalid Account (or) No such account number exist in our bank"; } break; case '4': cout<<"\n Enter the Account Number to which the Amount has to be Withdrawn:"; cin>>n; for(i=0;i<x;i++) { flag=B[i].Account(n); if(flag) { B[i].withdrawAmount(); break; } } if(!flag) { cout<<"\n Invalid Account (or) No such account number exist in our bank"; } break; case '5': cout<<"\n THANK YOU FOR VISITING OUR BANK"; break; default: cout<<"\n Wrong Option"; } cout<<"\n Do you want view more Employee Details ? (y/n).. "; cin>>opt; } while(opt=='y' || opt=='Y'); return 0; }
Submitted by Shivaani Mathan Kandasamy (Shivaani)
Download packets of source code on Coders Packet
Comments