Anda di halaman 1dari 1

void landpark()

void hotel()
void water ()
main ()
int options=0, e

e!=99
printf("\t\t HAPPY NEWYEAR!!\n")
True
printf("\n\n\n\tTHANKYOU\n\n\n")
False
printf("\t\t 2014\n")
printf("\t\t WELCOME TO OUR LAND !!\n\n")
printf("We oer you a Hotel and two theme parks which are Land and Water.\n")
printf("Land consists of two parks which are Amusement Park and ScreamPark.\n")
printf("Water also consists of two parks which are Underwater World and Sea World.\n")
printf("\nTo purchase online ticketing,\n")
printf("\tPress 1 for Hotel.\n")
printf("\tPress 2 for Land.\n")
printf("\tPress 3 for Water.\n")
printf("And press Enter.\n")
scanf("%d", &options)
printf("\n\n\n")
options==1
hotel()
True
options==2
False
printf("Press 1 to return to main page.\nPress 99 to exit.\n")
landpark()
True
options==3
False
water ()
True
printf("Your choice is not in the list. Please try again.")
False
scanf("%d", &e)
printf("\n\n\n")
0
void landpark()
int parknum, adultnum, childnum, seniornum, mykad
double total=0, sum=0, jumlah=0, keseluruhan=0
printf("\n\n\n\n_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-")
variable declaration for
landpark
printf("\n\nYou are visiting online ticketing for PAHlova Land.\n ")
printf("\nBelow are the details for tickets.\n\n")
printf("_______________________________________________________________________\n")
printf("Age category\t\t\t\tPrice per entry(RM)\n")
printf("_______________________________________________________________________\n")
Introduction to landpark
printf("\t\t\t\tAmusement Park\t\tScreamPark\n")
printf("_______________________________________________________________________\n")
printf("Adult\t\t\t\t\t90\t\t\t80\t\t\n")
printf("Children\t\t\t\t60\t\t\t50\t\t\n")
printf("Senior Citizen\t\t\t\t30\t\t\t40\n")
printf("_______________________________________________________________________\n")
printf("\n\n\nPlease enter the number of land park you are going and press Enter:\n\n")
printf("Press 1 = Amusement Park only\n")
printf("Press 2 = ScreamPark\n")
landpark options
printf("Press 3 = Amusement Park and ScreamPark\n\n\n")
scanf("%d", &parknum)
parknum==1
printf("\n\n Enter total number of adults and press Enter. :\n")
True False
scanf("%d", &adultnum)
Amusement Park only
printf("\n\nEnter total number of child and press Enter. :\n")
scanf("%d", &childnum)
printf("\n\n Enter total number of senior citizen and press Enter. :\n")
scanf("%d", &seniornum)
total = (adultnum 90.00) + (childnum 60.00) + (seniornum 40.00)
sum= total parknum
printf("\n\nDo you own a MyKad ? \n if yes, press 1. if no, press 2. then press Enter.\n")
total before discount for
amusement park only
scanf("%d", &mykad)
mykad<2
jumlah = sum 0.20
True
jumlah = 0
False
keseluruhan = sum- jumlah
printf("\n\n\nThe following is your details :\n\n")
keseluruhan = sum
total after discount for
amusement park only
printf("number of adults : %d\n", adultnum)
printf("number of children : %d\n", childnum)
resit for amusement park
only
printf("number of senior citizen : %d\n", seniornum)
printf("Total payment without MyKad(RM) : %0.2lf\n", sum)
printf("total discount, (RM): %0.2lf\n", jumlah)
printf("Total payment after discount: %0.2lf\n", keseluruhan)
else if (parknum==2) //ScreamPark only
printf("\n\n Enter total number of adults and press Enter. :\n")
scanf("%d", &adultnum)
printf("\n\nEnter total number of child and press Enter. :\n")
scanf("%d", &childnum)
printf("\n\n Enter total number of senior citizen and press Enter. :\n")
scanf("%d", &seniornum)
total = (adultnum 80.00) + (childnum 50.00) + (seniornum 30.00)
sum= total parknum
printf("\n\nDo you own a MyKad ? \n if yes, press 1. if no, press 2. then press Enter.\n")
total before discount for
screampark
scanf("%d", &mykad)
mykad<2
jumlah = sum 0.20
True
jumlah = 0
False
keseluruhan = sum- jumlah
printf("\n\n\nThe following is your details :\n\n")
keseluruhan = sum
total after discount for
screampark
printf("number of adults : %d\n", adultnum)
printf("number of children : %d\n", childnum)
resit screampark only
printf("number of senior citizen : %d\n", seniornum)
printf("Total payment without MyKad(RM) : %0.2lf\n", sum)
printf("total discount, (RM): %0.2lf\n", jumlah)
printf("Total payment after discount: %0.2lf\n", keseluruhan)
else if (parknum==3) //both parks
printf("\n\n Enter total number of adults and press Enter. :\n")
scanf("%d", &adultnum)
printf("\n\nEnter total number of child and press Enter. :\n")
scanf("%d", &childnum)
printf("\n\n Enter total number of senior citizen and press Enter. :\n")
scanf("%d", &seniornum)
total = (adultnum 180.00) + (childnum 110.00) + (seniornum 70.00)
sum= total parknum
printf("\n\nDo you own a MyKad ? \n if yes, press 1. if no, press 2. then press Enter.\n")
total before discount for
both parks
scanf("%d", &mykad)
mykad<2
jumlah = sum 0.20
True
jumlah = 0
False
keseluruhan = sum- jumlah
printf("\n\n\nThe following is your details :\n\n")
keseluruhan = sum
total after discount for
both parks
printf("number of adults : %d\n", adultnum)
printf("number of children : %d\n", childnum)
resit both parks
printf("number of senior citizen : %d\n", seniornum)
printf("Total payment without MyKad(RM) : %0.2lf\n", sum)
printf("total discount, (RM): %0.2lf\n", jumlah)
printf("Total payment after discount: %0.2lf\n", keseluruhan)
else
printf("\n\nThe number of parks you entered is invalid.\n\n")
void roomRes ()
void roomDetail ()
wrong number of park
int YY, MM, DD
function declaration
int Sroom= 15, Droom= 10, Froom= 10, Lroom= 10
int code
variable declaration
int z=1, r, b, m
char exitX
oat aa = 90, bb = 120, cc = 180, dd = 220, priceX
void hotel () // function denition
printf("\t \t \t HOTEL FArerro Rocher \n")
printf("\t \t \t RoomBooking Website \n")
printf("\t For any further inquiries, please contact us at 06-1234567 \n \n")
hotel header
roomDetail ()
printf("\nDo you want to book any room(s)? \n")
hotel contact number
printf("Yes (O) or NO (X) \n")
function call
scanf("%c", &exitX)
scanf("%c", &exitX)
booking option
exitX
roomRes ()
'O'
void roomDetail () //function denition
'X' printf("\nError!\n")
function call
exit back to main
printf("\n")
printf("ROOMS OFFERED \t \t \t \t \t \t PRICE (per day)\n")
printf("\n")
roomdetails
printf("Single Room\t : 2 single beds \t \t \t \t RM90 \n")
printf("Double Room\t : 1 queen size bed \t \t \t \t RM120 \n")
printf("Large Room\t : 1 single bed 1 queen size bed \t \t RM180 \n")
printf("Family Room\t : 2 queen size beds \t \t \t \t RM220 \n")
printf("\n")
void roomRes () //function denition
printf("\nInsert date (YYYY MMDD) :\n")
scanf("%d%d%d", &YY, &MM, &DD)
YY >= 2014
booking date
MM< 13 && MM> 0
True
printf("Invalid Date \n\n")
False
DD <= 31 && DD >= 1
True
False
printf("\n \t RoomAvailability \n")
True False
printf("\t (CODE 1)Single Room\t: %d \n", Sroom)
printf("\t (CODE 2)Double Room\t: %d \n", Droom)
roomavailability
printf("\t (CODE 3)Large Room\t: %d \n", Lroom)
printf("\t (CODE 4)Family Room\t: %d \n \n", Froom)
printf("Number of room(s) you want to book : \n")
scanf("%d", &r)
printf("\n \nSelect the room(s) (Insert the code number) : \n")
do //choose room
printf("%d. ", z)
scanf("%d", &code)
code == 1
priceX = priceX + aa
True
code == 2
False
Sroom= Sroom- 1
printf("Single Roomwith 2 single beds \t \t \t \tRM90.00 \n")
calculation for total price
z++
b++

priceX = priceX + bb
True
code == 3
False
Droom= Droom- 1
printf("Double Roomwith 1 queen size bed \t \t \tRM120.00 \n")
calculation for total price
priceX = priceX + cc
True
code == 4
False
Lroom= Lroom- 1
printf("Large Roomwith 1 single bed and 1 queen size bed \tRM180.00 \n")
calculation for total price
priceX = priceX + dd
True
printf("Invalid Code for %d \nPlease re-enter the roomcode number : \n", z)
False
Froom= Froom- 1
printf("Family Roomwith 2 queen size beds \t \t \tRM220.00 \n")
calculation for total price
b < r
True
printf("==================================================================\n")
False
printf("Total night(s)\t \t \t \t \t \t:")
scanf("%d", &m)
printf("Total Price : RM%.2f X %d \t \t \t \tRM%.2f \n", priceX, m, priceX m)
total nights staying
printf("==================================================================\n \n")
printf("THANK YOU FOR CHOOSING US. PLEASE COME AGAIN \n")
print total price
void water ()
printf ("\t\t\t wElCoMe tO SYUDshi wAtEr PaRk sELeCTiOn OnLInE \t\t\t\t\t\t\n")
printf ("=======================================================================================\n")
water park main page
printf ("Type of park t\t\t\t\t\t\tPrice\t\t\t\t\n")
printf ("_______________________________________________________________________________________\n")
printf ("\t\t\t\t\tChildren\tAdult\t\tSenior\n")
printf ("=======================================================================================\n")
printf ("1)Underwater world\t\t\t35\t\t55\t\t45\t\n")
printf ("2)Sea world\t\t\t\t30\t\t45\t\t25\t\n")
printf ("\n=======================================================================================\n")
int age
int card
variable declaration
int price=60
double total
double product
int n
int a=1
int p
double TotalP=0
printf ("Total ticket(s):\n")
scanf ("%d",&n)
printf ("Please choose park:\n")
scanf ("%d",&p)

p==1
True
for (a=1
False
a<=n
while loop 1
a++) //for loop 1
printf ("Please enter the age\n")
printf ("^^^^^^^^^^^^^^^^^^^^\n")
scanf ("%d",&age)
age <=12
total=price-25
True False
Price =RM%.2lf\n",total)
selection of ages
printf("^^^^^^^^^^^^^^^^^^^^^^^^^^\n")
else if (age >12 && age <60)
total=price-5
printf ("Adult:Price =RM%.2lf\n",total)
printf ("^^^^^^^^^^^^^^^^^^^^^^^\n")
else
total=price-15
printf ("Senior citizen:Price =RM%.2lf\n",total)
printf ("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n")
printf ("\nDo you have identication card:if
\n")
yes=1,no=0
printf ("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n")
scanf ("%d",&card)
card==1
product= total-(0.15 total)
True False
printf ("Malaysian: RM%.2lf \n",product)
selection of ic
printf ("^^^^^^^^^^^^^^^^^^^^\n")
else if (card==0)
product=total
printf ("Foreigner: RM%.2lf\n",product)
else
product=total-0
printf ("You have entered wrong number, no discount will be given :RM%.2lf\n",product)
TotalP=TotalP+product
p--

p==2
True
for(a=1
False
a<=n
while loop 2
a++) //for loop 2
printf ("Please enter the age\n")
printf ("^^^^^^^^^^^^^^^^^^^^\n")
scanf ("%d",&age)
age <=12
total=price-20
True False
Price =RM%.2lf\n",total)
selection ages
printf("^^^^^^^^^^^^^^^^^^^^^^^^^^\n")
else if (age >12 && age <60)
total=price-5
printf ("Adult:Price =RM%.2lf\n",total)
printf ("^^^^^^^^^^^^^^^^^^^^^^^\n")
else
total=price-25
printf ("Senior citizen:Price =RM%.2lf\n",total)
printf ("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n")
printf ("\nDo you have identication card:if
\n")
yes=1,no=0
printf ("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n")
scanf ("%d",&card)
card==1
product= total-(0.15 total)
True False
printf ("Malaysian: RM%.2lf \n",product)
selection of ic
printf ("^^^^^^^^^^^^^^^^^^^^\n")
else if (card==0)
product=total
printf ("Foreigner: RM%.2lf\n",product)
else
product=total-0
printf ("You have entered wrong number, no discount will be given :RM%.2lf\n",product)
TotalP=TotalP+product
p++
printf ("Your total price is : RM%0.2lf\n",TotalP)

Anda mungkin juga menyukai