GUJRAT INSTITUTE OF MANAGEMENT SCIENCES
ASSIGNMENT
COURSE TITLE: “OBJECT ORIENTED PROGRAMMING”
STUDENT NAME, ARID & CLASS: SAMREEN AMIR ,19-ARID-2811, BSCS-B
INSTRUCTOR NAME: SIR BILAL MAZHAR
SUBMISSION DATE:7-MAY-2020
***************************************************************************
**********
Challenging task:
#include <iostream>
using namespace std;
class UserBankAccount
private:
string d_name,d_address,A_Type;
long b;
int no_of_t=0;
int a_no=0;
static int n;
public:
void set_account_No()
a_no=n;
n++;
void set_depositor_Name(string n)
d_name=n;
string get_depositor_Name()
return d_name;
void set_depositor_Address(string n)
d_address=n;
string get_depositor_Address()
{
return d_address;
void set_depositor_Account_Type(string n)
A_Type=n;
string get_depositor_Account_Type()
return A_Type;
void set_balance(double n)
b=n;
double get_balance()
return b;
void set_no_Of_Transactions(long n)
no_of_t=n;
long get_no_Of_Transactions()
return no_of_t;
long get_account_No()
return a_no;
void deposit_amount(int n)
{
if(n==a_no)
long c;
cout<<"Enter amount to deposit ";
cin>>c;
b=b+c;
no_of_t++;
cout<<"Now: Depositor's current amount is "<<get_balance()<<endl;
void withdraw_amount(int n)
if(n==a_no)
long c;
cout<<"Enter amount to withdraw ";
cin>>c;
b=b-c;
no_of_t++;
cout<<"Now: Depositor's current amount is "<<get_balance()<<endl;
void search_account_No(int n)
if(a_no==n)
cout<<"Depositor's Name is "<<get_depositor_Name()<<endl;
cout<<"Depositor's Address is "<<get_depositor_Address()<<endl;
cout<<"Depositor's account type "<<get_depositor_Account_Type()<<endl;
cout<<"Depositor's current balance "<<get_balance()<<endl;
cout<<"No of transactions "<<get_no_Of_Transactions()<<endl;
void change_address(int n)
if(n==a_no)
string adr;
cin.ignore();
cout<<"Enter new address ";
getline(cin,adr);
set_depositor_Address(adr);
};
int UserBankAccount:: n=1000;
int main()
short choice;
int no_of_d=2;
string de_name, de_address;
string de_accountType;
long de_balance;
char ch;
cout<<"Enter number of depositor ";
cin>>no_of_d;
UserBankAccount D[no_of_d];
cout<<"\t\t\t=========================="<<endl;
cout<<"\t\t\t Bank Management System "<<endl;
cout<<"\t\t\t=========================="<<endl;
do
cout<<"\n\t\t\tMain Manu"<<endl;
cout<<"\t\t\t=========================="<<endl;
cout<<"\t\t\t1- Add new account\n\t\t\t2-Search Account\n\t\t\t3-Deposit Amount\n\t\
t\t4-Withdraw Amount"<<endl;
cout<<"\t\t\t============================"<<endl;
cout<<"Enter your choice ";
cin>>choice;
switch(choice)
case 1:
for(int i=0;i<no_of_d;i++)
cout<<"For Depositor "<<i+1<<endl;
cin.ignore();
cout<<"Enter Name of depositor ";
getline(cin,de_name);
D[i].set_depositor_Name(de_name);
cout<<"Enter Address of depositor ";
getline(cin,de_address);
D[i].set_depositor_Address(de_address);
cout<<"Enter Account type ";
getline(cin,de_accountType);
D[i].set_depositor_Account_Type(de_accountType);
cout<<"Enter Balance of depositor ";
cin>>de_balance;
D[i].set_balance(de_balance);
D[i].set_account_No();
break;
case 2:
int an;
cout<<"Enter account number to search ";
cin>>an;
for(int i=0;i<no_of_d;i++)
D[i].search_account_No(an);
break;
case 3:
int ano;
cout<<"Enter Account number to deposit amount ";
cin>>ano;
for(int i=0;i<no_of_d;i++)
D[i].deposit_amount(ano);
break;
}
case 4:
int ano;
cout<<"Enter Account number to withdraw amount ";
cin>>ano;
for(int i=0;i<no_of_d;i++)
D[i].withdraw_amount(ano);
break;
case 5:
int ano;
cout<<"Enter account number which address to be change ";
cin>>ano;
for(int i=0;i<no_of_d;i++)
D[i].change_address(ano);
break;
cout<<"Enter z to goto main menu";
cin>>ch;
}
while(ch!='n');
return 0;
Output:
The end