/*
Author : Jemmy R. Mongi
File : Account Bank.cpp
*/
#include
#include
#include
using
namespace std;
int
check_balance=0;
class Akun
{
protected :
int deposit,withdrawl;
char ulang;
public :
void Deposit();
void Withdrawl();
void Check_Balance();
};
void Akun ::
Deposit()
{
system("cls");
cout<<"Please Enter
Your deposit (deposit Minimal Rp.10.000,-): ";
cin>>deposit;
while(deposit < 10000)
{
system("cls");
cout<<"Sorry You
can't deposit under Rp.10.000,- you must deposit <
cout<<"Please
enter again your deposit : ";
cin>>deposit;
}
check_balance=check_balance+deposit;
cout<<"Thank you
the deposit has been successfully...!!\n";
}
void Akun ::
Withdrawl()
{
int done = 0;
while (done == 0)
{
cout<<"Enter your
withdrawl : ";
cin>>withdrawl;
if(withdrawl%50000 != 0)
{
system("cls");
cout<<"You can
only make withdrawl with multiplies Rp.50.000,-"<
}
else if(withdrawl >
check_balance)
{
system("cls");
cout<<"Your
withdrawl greater than your balance"<
}
else if((check_balance - withdrawl) < 100000)
{
system("cls");
cout<<"Your
balance must be Rp.100.000,- after this trasaction"<
}
else if(withdrawl > 5000000)
{
system("cls");
cout<<"Sorry
maximum withdrawl is Rp.5.000.000,-\n";
}
else
{
done = 1;
system("cls");
cout<<"Withdrawl
successfully...!!\n";
check_balance=check_balance-withdrawl;
}
}
}
void Akun ::
Check_Balance()
{
system("cls");
cout<<"Your Balance is
Rp."<
}
int main()
{
char ulang;
int choice;
Akun akses;
do
{
system("cls");
cout<
cout<<"Make selection to
transaction\n";
cout<<"1. Deposit\n";
cout<<"2. Withdrawl\n";
cout<<"3. Check Balance\n";
cout<<"Enter Your Choice :
";
cin>>choice;
switch(choice)
{
case 1 :
akses.Deposit();
break;
case 2 :
akses.Withdrawl();
break;
case 3 :
akses.Check_Balance();
break;
default :
system("cls");
cout<<"Your choice
is not available"
<<"\npress any
key to exit..";
ulang=getch();
exit(0);
}
cout<<"\nDo you want to
transaction again...?\n"
<<"press y to continue or
press any key to exit";
ulang=getch();
if(ulang!='y')
exit(0);
}while(ulang=='y');
getch();
}
No comments:
Post a Comment