Вы находитесь на странице: 1из 15

Term paper on Topic :BANKING Object Oriented Programming CSE202

Submitted to: Mr. Munish Kumar Dept of CSE

Submitted by: RavleenKaur RK3002A01 11008672

SOURCE CODE
/*program to enter the details to create an account, edit the account transactions and to enter the details of loan offered*/ #include<iostream.h> #include<conio.h> #include<stdio.h> class bank { protected: char name[15]; charfather_name[15]; longint balance; int total; int id; int age; public: void display() { cout<<"\nEnter name:"; gets(name); cout<<"\nEnter id:"; cin>>id; puts(name); cout<<endl;

cout<<id; } }; class transaction : private bank //class for money transaction {

int withdraw; public: void display2() { display(); cout<<"\nTotal balance:"; cin>>total; cout<<"\nEnter money to b withdrawn:"; cin>>withdraw; cout<<"\nBalance is"; balance=total-withdraw; cout<<"\nBalance is"<<" "<<balance; }}; classnwaccount :private bank //class to create new account in bank { int money; public: void display3() {

display(); cout<<"\nEnter father name:"; gets(father_name); cout<<"\nAge:"; cin>>age; cout<<"\nMoney:"; cin>>money; puts(father_name); cout<<" "<<age <<" "<<money; } }; classdeposit:private bank //class to deposit money in the bank { intdep; public: void display4() { display(); cout<<"\nTotal balance:"; cin>>total; cout<<"\nEnter money to b deposited:"; cin>>dep; cout<<"\nBalance is:"; balance=total+dep; cout<<"\nBalance is"<<" "<<balance;

}}; classedit_account:private bank { intchh; char c; public: void display1() {display();} void display5(); void display6() { puts(name); cout<<age<<" "<<id; puts(father_name); }

}; voidcalc_loan(float p,floatr,float t) { floati,a; i=(p*r*t)/100; a=p+i; cout<<"Amount to be paid after "<<t<<" years:"<<a; } classloan:private bank

{ float principal; float rate; float time; public: voidsel_type(); voidloan_payment(); }; void loan::loan_payment() { intmp; longintcno; floatamt; cout<<"Enter mode of payment:\n"; cout<<"Press 1 for Credit card\n" <<"Press 2 for cash"; cin>>mp; if(mp==1) { cout<<"Credit Card\n" <<"Enter credit card number:"; cin>>cno; cout<<"Enter amount:"; cin>>amt; balance=balance-amt;

cout<<"\nAmount paid!"; principal=principal-amt; cout<<"Note down your new Principal:"<<principal; sel_type(); } if(mp==2) { cout<<"Enter amount:"; cin>>amt; balance=balance-amt; cout<<"\nAmount paid!"; principal=principal-amt; cout<<"\nNote down your new Principal:"<<principal; cout<<"\nDetails for the pending amount:\n"; sel_type(); } } void loan::sel_type() { int c; cout<<"Enter balance:"; cin>>balance; if(balance>=75000) { cout<<"\nYou can apply for loan\n";

cout<<"Press 1 for education loan"; cout<<"\nPress 2 for house loan"; cout<<"\nPress 3 for car loan"; cout<<"\nPress 4 for others\n"; cout<<"Enter your choice:"; cin>>c; switch(c) { case 1: { cout<<"Education Loan:\n"; cout<<"Enter Principal:"; cin>>principal; rate=2; cout<<"\nEnter time:"; cin>>time; calc_loan(principal,rate,time); break; } case 2: { cout<<"House Loan:\n"; cout<<"Enter Principal:"; cin>>principal; rate=5;

cout<<"\nEnter time:"; cin>>time; calc_loan(principal,rate,time); break; } case 3: { cout<<"Car Loan:\n"; cout<<"Enter Principal:"; cin>>principal; rate=4; cout<<"\nEnter time:"; cin>>time; calc_loan(principal,rate,time); break; } case 4: { cout<<"Others:\n"; cout<<"Enter Principal:"; cin>>principal; rate=3; cout<<"\nEnter time:"; cin>>time; calc_loan(principal,rate,time);

break; } } } else cout<<"\nYou do not have enough balance to apply for loan\n"; } void main() { intch; char p; clrscr(); cout<<"Press 1 for withdrawal\nPress 2 for nw account\n"; cout<<"Press 3 for deposit:\n"; cout<<"Press 4 for loan section:\n"; cin>>ch; switch(ch) { case 1: { transaction obj1; obj1.display2(); break; } case 2:

{ nwaccount obj2; obj2.display3(); break; } case 3: { deposit obj3; obj3.display4(); break; } case 4: { loan obj4; obj4.sel_type(); cout<<"Enter 'p' for loan payment:"; cin>>p; if(p=='p') obj4.loan_payment(); break; } default: { cout<<"You have antered the wrong choice!"; }}

getch(); }

SCREEN SHOTS

Вам также может понравиться