Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Define a class to represent a bank account. Include the
following
members:
Data Members:
Name of the Depositor
Account Number
Type of Account
Balance amount in the account

Member Functions:
To assign the initial values.
To deposit an account.
To withdraw an amount after checking the balance.

Write a C++ main program to display account number,
name and
balance.

Answer Posted / arun

#include<iostream.h>
#include<stdio.h>
#include<conio.h>
#include<process.h>


// statement of customer detail....

struct acc_inf
{
char c_name[25];
int acc_no;
float balance;
char acc_type[7];

};

//statement of Class....

class bank
{
struct acc_inf x;
public:
void input();
void withdrawal(int,float);
void deposit(int,float);
void display(int);

};

// Statement of customer information...

void bank:: input()
{
cout<<endl<<" Enter the name of customer:- ";
gets(x.c_name);
cout<<" Enter account no:- ";
cin>>x.acc_no;
cout<<" Enter opening balance:- ";
cin>>x.balance;
cout<<" Enter acc_type (SAVING/CURRENT):- ";
gets(x.acc_type);
}

//Statement of Withdrawal function...

void bank::withdrawal(int ac,float money)
{
if(x.acc_no==ac)
{
if(x.balance-1000>=money)
x.balance -= money;
else
cout<<"Sorry, Insufficient Balance";
}
else
cout<<"** Sorry, Account no. is not found ** ";
}

// Statement of deposite function...

void bank::deposit(int ac,float money)
{
if(ac==x.acc_no)
x.balance += money;
else
cout<<"Sorry, Account no. is not found...";
}

// Statement of display Funtion...

void bank::display(int ac)
{
if(ac==x.acc_no)
{
cout<<"\nYour acc_no is: "<<x.acc_no;
cout<<"\nYour name is: ";
puts(x.c_name);
cout<<"\nYour current balance is: "<<x.balance;
cout<<"\nYour type of account is: "<<x.acc_type;
}
}

// statement of main Function....

main()
{

bank obj; //creating object for class bank
int ac;
float money;
int c;
clrscr();
do
{
clrscr();
cout<<endl<<"Welcome to Banking System";
cout<<"\n_________________________";
cout<<endl<<endl<<"1:Open New Account of the customer.";
cout<<endl<<"2:Withdrawal the money.";
cout<<endl<<"3:Deposit the money.";
cout<<endl<<"4:Display information about customer.";
cout<<endl<<"5:quit";
cout<<endl<<"what is your choice: ";
cin>>c;

switch(c)
{
case 1:
obj.input();
break;
case 2:
cout<<"Enter account no: ";
cin>>ac;
cout<<"enter the money to withdrawal: ";
cin>>money;
obj.withdrawal(ac,money);
break;
case 3:

cout<<"enter acc no: ";
cin>>ac;
cout<<"enter the money to deposit: ";
cin>>money;
obj.deposit(ac,money);
break;
case 4:
cout<<"enter acc no: ";
cin>>ac;
obj.display(ac);
break;
case 5:
exit(0);
default:
cout<<"Sorry, unable to process.. Try again later";
}
cout<<"Press Enter to continue...";
getch();

}while(c!=5);

return 0;
}

Is This Answer Correct ?    55 Yes 25 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which language is not a true object oriented programming language?

1114


How to hide the base class functionality in Inheritance?

1124


How does polymorphism work?

1117


What is the advantage of oop over procedural language?

1065


what is difference between class template and template class?

2644


What are the types of abstraction?

1056


What is the oops and benefits of oops programming?

964


What is encapsulation and abstraction? How are they implemented in C++?

1118


What are the benefits of oop?

1232


Can a varargs method be overloaded?

1086


How Do you Code Composition and Aggregation in C++ ?

25418


i am getting an of the type can not convert int to int *. to overcome this problem what we should do?

2305


What is object and class in oops?

1048


Which method cannot be overridden?

1071


What is Difference Between Inheritance and creating object and getting data? means Class A extends B{ B.getMethod();} (OR) Class A{ b obj=new B(); obj.getMethod(); }

2579