Hello All,
Here is the programm simulating the ATM.
I want the little help in how to repeat the conditions in loop, because as I change the conditions, program doesn't perform any calculation.
Kindly if anybody can help me in this regard.
RegardsCode:#include<iostream.h> #include<string.h> #include<iomanip.h> #include<conio.h> class BankTransaction { private: int iBalance,NewBalance,Adjustment,AnnualInterestRate,Interest; public: void Deposit(); void Withdrawl(); void Balance(); void Display(); void InterestRate(); void AnnualInterest(); }; void BankTransaction :: Deposit () { cout<<"\n Enter the amount to deposit:"; cin>>NewBalance; iBalance = iBalance + NewBalance; } void BankTransaction :: Withdrawl() { int amount = 0; cout<<"Enter amount to be withdraw:\n"; cin>>amount; if(amount >iBalance) { cout<<"Not enough balance to be withdrawn.\n";; cout<<"Maximum money can be withdrawn: "<<iBalance<<"\n"; } else { iBalance = iBalance - amount; } } void BankTransaction :: Balance() { cout<<"Current Balnce: " <<iBalance; } void BankTransaction:: InterestRate() { cout<<"\n Enter the interest rate: \n"; cin>>AnnualInterestRate; } void BankTransaction:: AnnualInterest () { cout<<"\n Enter the interest rate: \n"; iBalance = iBalance -(AnnualInterestRate / 100); cout<<"Current Balance: " << iBalance; } void main() { BankTransaction a; //creating array of objects int input = 0; do { clrscr(); cout<<"\n Enter the value to perform : \n"; cout<<"\n 1: Deposit : \n"; cout<<"\n 2: Withdraw : \n"; cout<<"\n 3: Get Balance : \n"; cout<<"\n 4: Set annual interest rate : \n"; cout<<"\n 5: Calculate interest : \n"; cin>>input ; if(input == 1) a.Deposit(); else if(input == 2) a.Withdrawl(); else if(input == 3) a.Balance(); else if(input == 4) a.InterestRate(); else if(input == 5) a.AnnualInterest(); // a.Display(); }while(input == 0); getch(); }