Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Aim: To implement a program for bank account using static data type.
Code:
class bank
{
static int acc_no;
int acc;
float bal;
public:
int open_ac(float b)
acc_no++;
acc=acc_no;
bal=b;
return(acc_no);
}
void deposit()
int am;
cout<<"Enter amount: Rs.";
cin>>am;
bal=bal+am;
cout<<"Amount Deposited!\nNew Balance: Rs. "< } void withdrawl() { int am; cout<<"Enter amount: Rs."; cin>>am; if(bal<(am+500)) cout<<"Sorry! transaction can not be processed. Balance not available."; else { bal=bal-am; cout<<"Amount withdrawn."; cout< } } }; int bank :: acc_no=99; void main() { int c,x=0,b,id; clrscr(); bank cust[5]; cout<<"BANK DATABASE"; do { cout<<"\n1. Create A/c.\n2. Deposit\n3. Withdrawl\n4. Exit"; cout<<"\n\nEnter your choice:"; cin>>c; switch(c) { case 1: cout< cin>>b; id=cust[x].open_ac(b); x++; cout<<"You a/c is opened! A/c No. "< break; case 2: cout<<"Enter A/c No. for deposit:"; cin>>id; if(id>(x+99)) { cout<<"Wrong A/c no."; break; } cust[id-100].deposit(); break; case 3: cout<<"Enter A/c No. for withdrawl:"; cin>>id; if(id>(x+99)) { cout<<"Wrong A/c no."; break; } cust[id-100].withdrawl(); break; case 4: exit(1); break; } }while(x<=4); getch(); } Output: BANK DATABASE 1. Create A/c. 2. Deposit 3. Withdrawl 4. Exit Enter your choice:1 Enter balance:4000 You a/c is opened! A/c No. 100 1. Create A/c. 2. Deposit 3. Withdrawl 4. Exit Enter your choice:2 Enter A/c No. for deposit:100 Enter amount: Rs.800 Amount Deposited! New Balance: Rs. 4800 1. Create A/c. 2. Deposit 3. Withdrawl 4. Exit Enter your choice:3 Enter A/c No. for withdrawl:100 Enter amount: Rs.900 Amount withdrawn. Balance: Rs.3900 1. Create A/c. 2. Deposit 3. Withdrawl 4. Exit Enter your choice:4
void withdrawl()
if(bal<(am+500))
cout<<"Sorry! transaction can not be processed. Balance not available.";
else
bal=bal-am;
cout<<"Amount withdrawn.";
cout< } } }; int bank :: acc_no=99; void main() { int c,x=0,b,id; clrscr(); bank cust[5]; cout<<"BANK DATABASE"; do { cout<<"\n1. Create A/c.\n2. Deposit\n3. Withdrawl\n4. Exit"; cout<<"\n\nEnter your choice:"; cin>>c; switch(c) { case 1: cout< cin>>b; id=cust[x].open_ac(b); x++; cout<<"You a/c is opened! A/c No. "< break; case 2: cout<<"Enter A/c No. for deposit:"; cin>>id; if(id>(x+99)) { cout<<"Wrong A/c no."; break; } cust[id-100].deposit(); break; case 3: cout<<"Enter A/c No. for withdrawl:"; cin>>id; if(id>(x+99)) { cout<<"Wrong A/c no."; break; } cust[id-100].withdrawl(); break; case 4: exit(1); break; } }while(x<=4); getch(); } Output: BANK DATABASE 1. Create A/c. 2. Deposit 3. Withdrawl 4. Exit Enter your choice:1 Enter balance:4000 You a/c is opened! A/c No. 100 1. Create A/c. 2. Deposit 3. Withdrawl 4. Exit Enter your choice:2 Enter A/c No. for deposit:100 Enter amount: Rs.800 Amount Deposited! New Balance: Rs. 4800 1. Create A/c. 2. Deposit 3. Withdrawl 4. Exit Enter your choice:3 Enter A/c No. for withdrawl:100 Enter amount: Rs.900 Amount withdrawn. Balance: Rs.3900 1. Create A/c. 2. Deposit 3. Withdrawl 4. Exit Enter your choice:4
};
int bank :: acc_no=99;
void main()
int c,x=0,b,id;
clrscr();
bank cust[5];
cout<<"BANK DATABASE";
do
cout<<"\n1. Create A/c.\n2. Deposit\n3. Withdrawl\n4. Exit";
cout<<"\n\nEnter your choice:";
cin>>c;
switch(c)
case 1:
cout< cin>>b; id=cust[x].open_ac(b); x++; cout<<"You a/c is opened! A/c No. "< break; case 2: cout<<"Enter A/c No. for deposit:"; cin>>id; if(id>(x+99)) { cout<<"Wrong A/c no."; break; } cust[id-100].deposit(); break; case 3: cout<<"Enter A/c No. for withdrawl:"; cin>>id; if(id>(x+99)) { cout<<"Wrong A/c no."; break; } cust[id-100].withdrawl(); break; case 4: exit(1); break; } }while(x<=4); getch(); } Output: BANK DATABASE 1. Create A/c. 2. Deposit 3. Withdrawl 4. Exit Enter your choice:1 Enter balance:4000 You a/c is opened! A/c No. 100 1. Create A/c. 2. Deposit 3. Withdrawl 4. Exit Enter your choice:2 Enter A/c No. for deposit:100 Enter amount: Rs.800 Amount Deposited! New Balance: Rs. 4800 1. Create A/c. 2. Deposit 3. Withdrawl 4. Exit Enter your choice:3 Enter A/c No. for withdrawl:100 Enter amount: Rs.900 Amount withdrawn. Balance: Rs.3900 1. Create A/c. 2. Deposit 3. Withdrawl 4. Exit Enter your choice:4
cin>>b;
id=cust[x].open_ac(b);
x++;
cout<<"You a/c is opened! A/c No. "< break; case 2: cout<<"Enter A/c No. for deposit:"; cin>>id; if(id>(x+99)) { cout<<"Wrong A/c no."; break; } cust[id-100].deposit(); break; case 3: cout<<"Enter A/c No. for withdrawl:"; cin>>id; if(id>(x+99)) { cout<<"Wrong A/c no."; break; } cust[id-100].withdrawl(); break; case 4: exit(1); break; } }while(x<=4); getch(); } Output: BANK DATABASE 1. Create A/c. 2. Deposit 3. Withdrawl 4. Exit Enter your choice:1 Enter balance:4000 You a/c is opened! A/c No. 100 1. Create A/c. 2. Deposit 3. Withdrawl 4. Exit Enter your choice:2 Enter A/c No. for deposit:100 Enter amount: Rs.800 Amount Deposited! New Balance: Rs. 4800 1. Create A/c. 2. Deposit 3. Withdrawl 4. Exit Enter your choice:3 Enter A/c No. for withdrawl:100 Enter amount: Rs.900 Amount withdrawn. Balance: Rs.3900 1. Create A/c. 2. Deposit 3. Withdrawl 4. Exit Enter your choice:4
break;
case 2:
cout<<"Enter A/c No. for deposit:";
cin>>id;
if(id>(x+99))
cout<<"Wrong A/c no.";
cust[id-100].deposit();
case 3:
cout<<"Enter A/c No. for withdrawl:";
cust[id-100].withdrawl();
case 4:
exit(1);
}while(x<=4);
getch();
Output:
BANK DATABASE
1. Create A/c.
2. Deposit
3. Withdrawl
4. Exit
Enter your choice:1
Enter balance:4000
You a/c is opened! A/c No. 100
Enter your choice:2
Enter A/c No. for deposit:100
Enter amount: Rs.800
Amount Deposited!
New Balance: Rs. 4800
Enter your choice:3
Enter A/c No. for withdrawl:100
Enter amount: Rs.900
Amount withdrawn.
Balance: Rs.3900
Enter your choice:4
Question: (a) Explain a linked list. (b) Describe the three different types of linked list with the help of diagrams. (c) Give two advantages and two disadvantages
algorithm to prepare mark sheet of a student by inputing name,branchcode,semester,register no,5 marks of students and total mark of student
The game of hangman may have originated in the Victorian era, and involves trying to guess a word by suggesting letters. The game is played as follows: A word is chosen and the pl
YOU HAVE GIVEN THE MARKED UP PRICE OF 80% AND DISCOUNT PRICE OF 10% THEN FIND THE SELLING PRICE
you are to create a text adventure game that uses pointers. You have a rich, eccentric Uncle Billy who is soon to be deceased. How soon.....oops......he''s gone. He has left yo
Ravi is a newbie to the programming and while learning the programming language he came to know the following rules:
Write a c++ program to find the sum of 0.123 ? 103 and 0.456 ? 102 and write the result in three significant digits.
What is the real function of class - to export data? No, Real purpose of a class isn't to export data. Instead, it's to provide services. Class provides a way to abstract behav
Write a C++ program with header and source files to store street addresses using the Doubly Linked List ADT. Modify the Node class from Lab Assignment 3 so that it becomes a node i
Webcam Driver static library or DLL required for Windows I want a .dll or .lib file using which i will take a snapshot from the webcam and it can't turn on the webcam LED while
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +1-415-670-9521
Phone: +1-415-670-9521
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd