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

write a code for this:trailer recordId contains a value other than 99, then the file must error with the reason ‘Invalid RECORD_ID’(User Defined Exception).

2116


What is difference between data abstraction and encapsulation?

1051


Whats is abstraction in oops?

1036


what are the different types of qualifier in java?

2234


Can we create object of interface?

1088


What is encapsulation in ict?

1010


how to get the oracle certification? send me the answer

2129


Why do while loop is used?

995


Why is abstraction needed?

1001


What is polymorphism explain?

1211


What is encapsulation in oops?

974


What is pointer in oop?

990


What makes a language oop?

1021


Can bst contain duplicates?

1164


How is class defined?

1085