# include using namespace std; class BnkCust { public: BnkCust(); void saving(double,int); void cheking(double,int); double getsavn(); double get(); void tranf(double, int); private: double check; double savn; }; BnkCust::BnkCust() { } { } { } {
savn=0.0; check=0.0; double BnkCust::get() return check; double BnkCust::getsav() return savn; void BnkCust::cheking(double addc,int z) if(z==1){ if(addc>0) check=(check+addc); else cout<<"Incorrect Value!!"<<endl; } else if (z==2){ if(addc>check) cout<<"Error!!The money is not available.\n"<<endl; else check=check-addc; }
} { { }
void BnkCust::saving(double adds,int z) if(z==1) if(adds>=0){ cout<<"Please enter 0:"<<endl; savn =savn + adds; else cout<<"Incorrect Value!!"<<endl; } else{
if(adds>savn) cout<<"Error!!The money is not available.\n"<<endl; else savn=savn-adds; } } void BnkCust::tranf(double cant, int z) { { }
if (z==1) savn-=cant; check+=cant; else { savn+=cant; check-=cant;
} } {
int main() BnkCust m,[1000]; int option,z,id; double addc,adds,check,savn,cant;
cout<<"*******************Welcome to the ATM*******************"<<endl; cout<<"Please enter your account number(the account number most be between 1 and 1000)"<<endl; cin>>id; do{ cout<<"1) Make deposits or retire in checks:\n" <<"2) Make deposits or retire in savings:\n" <<"3) Make transactions:\n" <<"4) Verify your actual balances:\n" <<"5) Exit:\n"; cin>>option; if (option==5) return 0; while(option<0||option>4) {cout<<"Error!! Wrong option. Re-enter:"<<endl; cin>>option; } switch (option) { case 1: { check=m[id].get(); cout<<"The quantity of money available in your check account is: "<>z; while (z>2||z<0) {cout<<"Error!! Wrong option. Re-enter:"<<endl; cin>>z; } if(z==1) { cout<<"Enter the quantity you desire to deposit:"<<endl; cin>>addc; while (addc<0)
{cout<<"Error!! Wrong option. Re-enter."<<endl; cin>>addc; } m[id].cheking(addc,z); }else { cout<<"Enter the quantity you desire to get:"<<endl; cin>>addc; while (addc<0) { cout<<"Error!! Wrong option. Re-enter."<<endl; cin>>addc; } m[id].cheking(addc,z); } break; } case 2: { savn=m[id].getsavn(); cout<<"The quantity of money in your savings account is:"<<savn<<endl; cout<<"1)To make deposits\n" <<"2)To make withdraw\n"; cin>>z; while (z>2||z<0) {cout<<"Error!! Wrong option. Re-enter."<<endl; cin>>z; } if(z==1) { cout<<"Enter the quantity you desire to deposit:"<<endl; cin>>adds; while (adds<0) {cout<<"Error!! Wrong option. Re-enter."<<endl; cin>>adds; } m[id].saving(adds,z); }else { cout<<"Enter the quantity you desire to get:"<<endl; cin>>adds; while (adds<0) { cout<<"Error!! Wrong option. Re-enter."<<endl; cin>>addc; } m[id].saving(adds, z); } break; }
case 3: { savn=m[id].getsavn(); cout<<"The quantity of money in your savings account is"<<savn<<endl; chek=luis[id].get(); cout<<"The quantity of money available in your check account is "<
} }
}
cin>>z; while (z>2||z<0) {cout<<"Error!! Wrong option. Re-enter."<<endl; cin>>z;} if (z==1) { cout<<"Enter the quantity you desire to exchange:"<<endl; cin>>cant; while(cant>savn){ cout<<"Error!! The noney is not available.\n"<<endl; cin>>cant; } m[id].tranf(cant,z); }else { cout<<"Enter the quantity you desire to exchange:"<<endl; cin>>cant; while(cant>check){ cout<<"Error!! The noney is not available.\n"<<endl; cin>>cant; } m[id].tranf(cant,z); break;} case 4: { savn=m[id].getsavn(); cout<<"The quantity of money in your savings account is:"<<savn<<endl; check=luis[id].get(); cout<<"The quantity of money in your check account is:"<
Related Documents