a simple banking program for beginners

to implement bank ac which provides saving and current ac details

Page 1 of 1

1 Replies - 19576 Views - Last Post: 28 September 2008 - 11:29 AM Rate Topic: -----

#1 yogesh khunteta  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 28-September 08

a simple banking program for beginners

Post icon  Posted 28 September 2008 - 11:23 AM

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
class sbi
{float rate;
float balance;
int acno;
float intrest;
public:
 sbi()
{cout<<"\n\t\t\t\t ********welcome  STATE BANK OF INDIA, KOCHI******\n";
cout<<"\n get intrest @ rate 2.5% per month in your saving account\n";
cout<<"\nenter the oeaning balance";
cin>>balance;
 }

void display(void);
void deposit(void);
void withdraw(void);
void menu(void);
friend sbi intrest(sbi);
};

void sbi :: display(void)
{ cout<<"\nyour ac no. is"<<acno<<"\nyour  balance is\t"<<balance;

 }
void sbi::deposit(void)
{ float deposit;
cout<<"enter the amount to be deposited\n";
cin>>deposit;
balance=balance+deposit;
cout<<"\n your blance is now"<<balance;
}
void sbi::withdraw(void)
{float withdraw;
cout<<"\n enter the amount you want to withdraw";
cin>>withdraw;
balance=balance-withdraw;
cout<<"\n your blance is now"<<balance;
}
void sbi::menu(void)
{   cout<<"welcome \n\t\t\t\t STATE BANK OF INDIA\n enter your account no\n";
cin>>acno;
cout<<"enter your choice \na-account details\nb-deposit\nc-withdraw\ni-balance with intrest\nq-quit\n";
}
sbi intrest(sbi s)
{int time;
s.rate=2.5;
cout<<"enter the time in months\n";
cin>>time;
s.intrest=s.balance*s.rate*time/100;
s.balance=s.balance+s.intrest;
cout<<"\n balance="<<s.balance<<"\n intrest="<<s.intrest<"\n a/c no.";
return s;
}
void main()
{ int ch;
 sbi kochi;
 char c;
cout<<"enter your account type\n1 current a/c\n 2 saving a/c";
cin>>ch;
switch(ch)
{ case 1:
kochi.menu();
 cout<<"\n enter choice here " ;
 
 while((c=getchar())!='q')
 { switch©
 { case 'a':
	cout<<"\n ac type--current account\n";
	kochi.display();
	break;
	case 'b':
	kochi.deposit();
	break;
	case'c':
	kochi.withdraw();
	break;
	case'i':
	cout<<"\nyou will not get intrest in current a/c";

	break;
		 }
		 } break;
		 case 2:
 cout<<"\n here you will get 2.5% intrest";
 kochi.menu();
 while((c=getchar())!='q')
 { switch©
 { case 'a':
   cout<<"\n account type--saving account\n";
	kochi.display();
	break;
	case 'b':
	kochi.deposit();
	break;
	case'c':
	kochi.withdraw();
	break;
	case'i':
 kochi= intrest(kochi);

	break;
		 }}break;
		 }
	  cout<<"**************thank you for using sbi services***********";
		 getch();
		 }



Mod Edit: Please use code tags when posting your code. Code tags are used like so => :code:

Thanks,
PsychoCoder :)

Is This A Good Question/Topic? 0
  • +

Replies To: a simple banking program for beginners

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1639
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: a simple banking program for beginners

Posted 28 September 2008 - 11:29 AM

Is there a question there somewhere?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1