1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
#include <iostream>
using namespace std;
int displaymenuM();
int displaymenuN();
float chargeM(int, int, int, int);
float chargeN(int, int, int, int);
int main()
{
char citizen;
int menus, adult60, adult12, child3, child2, bonus;
float total, charge;
cout<<"Welcome to Bukit Merah Water Park"<<endl<<endl;
cout<<"Please enter your citizen (M : Malaysians / N : Non-Malaysians) : ";
cin>>citizen;
if(citizen=='M')
{
cout<<endl<<endl;
menus=displaymenuM();
cout<<"Enter number of Adult (60 and above) :";
cin>>adult60;
cout<<"Enter number of Adult (12 to 59) :";
cin>>adult12;
cout<<"Enter number of Children (3 and 11) :";
cin>>child3;
cout<<"Enter number of Children (below 3 years) :";
cin>>child2;
total=chargeM(adult60, adult12, child3, child2);
cout<<"\nHave BonusLink Card? (Y-Yes / N-No) : ";
cin>>bonus;
if (bonus=='Y')
{
charge=total-(0.2*total);
}
}
else if(citizen=='N')
{
cout<<endl<<endl;
menus=displaymenuN();
cout<<"Enter number of Adult (60 and above) :";
cin>>adult60;
cout<<"Enter number of Adult (12 to 59) :";
cin>>adult12;
cout<<"Enter number of Children (3 and 11) :";
cin>>child3;
cout<<"Enter number of Children (below 3 years) :";
cin>>child2;
total=chargeN(adult60, adult12, child3, child2);
cout<<"\nHave BonusLink Card? (Y-Yes / N-No) : ";
cin>>bonus;
if (bonus=='Y')
{
charge=total-(0.2*total);
}
}
else
{
cout<<"Sorry, wrong input"<<endl;
}
cout<<"\n\n Total price is : RM "<<charge<<endl<<endl;
system("PAUSE");
return 0;
}
int displaymenuM()
{
cout<<"Price list :"<<endl<<endl;
cout<<"Adult (60 and above) RM 18.00"<<endl;
cout<<"Adult (12 to 59) RM 28.00"<<endl;
cout<<"Children (3 and 11) RM 22.00"<<endl;
cout<<"Children (below 3 years) free"<<endl<<endl;
}
int displaymenuN()
{
cout<<"Price list :"<<endl<<endl;
cout<<"Adult (60 and above) RM 18.00"<<endl;
cout<<"Adult (12 to 59) RM 38.00"<<endl;
cout<<"Children (3 and 11) RM 28.00"<<endl;
cout<<"Children (below 3 years) free"<<endl<<endl;
}
float chargeM(int a, int b, int c, int d)
{
float tcharge;
tcharge=(18*a)+(28*b)+(22*b)+(0*d);
return tcharge;
}
float chargeN(int a, int b, int c, int d)
{
float tcharge;
tcharge=(18*a)+(38*b)+(28*b)+(0*d);
return tcharge;
}
|