Machine Project: CS10-1L Hotel Accommodation and Services System
Machine Project: CS10-1L Hotel Accommodation and Services System
CS10-1L
Hotel Accommodation
and
Services System
Submitted by:
ALVIENTO, Erick V.
LEONARDO, Darwin Christian G.
A10
MW 12:00-4:30 PM
Submitted to:
Engr. Cheryl Mari M. Isip
________________
NAME & SIGNATURE
________________
NAME & SIGNATURE
Then the user shall input the number of nights he/she will stay to be able to display the
total expenses. The user shall input a number greater than zero as the number of days he/she will
stay which then will be multiplied to the price of the room. If the user will input a number that is
less than or equal to 0, the program will ask the user again.
Then, the user shall input his payment method, which will be credit or cash. If the
payment method is credit, the program shall ask the user’s credit number to be able to show the
remaining balance and the credit balance after paying. Otherwise, if it is cash, the user shall input
the amount he/she will pay and displaying his/her change. Yet, if expenses are greater than cash,
the program will ask the user again.
After completing the process, leave a Thank You message for the users.
III. DESIGN
a) Source Code
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <time.h>
do{
menu:
cout<<"Press 1 for Suite Room \n"<<endl;
cout<<"Press 2 for Econo Room \n"<<endl;
cout<<"Press 3 for Family Room \n"<<endl;
cout<<"Press 4 for Studio Room \n"<<endl;
cout<<"Press 5 for Checkout and Exit \n"<<endl;
cout<<"Choose your Desired Room: ";
cin>>selection;
cout<<"\n"<<"\n"<<endl;
}while(selection <! 6);
switch(selection){
case 1:
cout<<"You selected Suite type"<<endl;
cout<<"Here is the brief information about this room. \n"<<endl; //Descriptions
cout<<"Suite type room/Presidential Suite\n"<<endl;
cout<<"Perfect for honeymoons and entertaining clients.\nThis fully air-conditioned
roomfeatures a bedroom with a king sized bed.\nDigital tv, office table and own bath room with
a fashionable bathtub.\nIt also features a dining room, a kitchen area,a living room with a 32-
inch tv, a balcony with the perfect view of the city lights.\n"<<endl;
cout<<"The price of suite room is: 18000 Pesos\n"<<endl;
repeat:
cout<<"How many nights would you like to stay?: ";
cin>>stay;
cout<<"\n"<<endl;
if(stay <= 0){
cout<<"Error Number of Stay, Must be Atleast 1 Day! \n"<<endl;
goto repeat;
}
if(stay>=1)
expenses = 18000 * stay;
cout<<"The total expenses will be: "<<expenses<<"Pesos"<<"\n"<<endl;
esc:
cout<<"Choose Payment Method \n"<<endl;
cout<<"Press 1 if credit card\nPress 2 if cash\nPayment Method: ";
cin>>choice;
int fb;
if (choice == 1){
cout<<"May we have your credit card so we can process your Transaction \n"<<endl;
cred:
cout<<"Enter Card Number: "; // name and balance of card
cin>>a;
cout<<"\n"<<endl;
srand (time(NULL));
b = (rand()*1)*a;
fb = b;
cout<<"Credit card holder Code is:PM-13-0957"<<a<<"\n"<<endl;
if(expenses > fb){
cout<<"We're sorry but you dont have enough Balance \n"<<endl;
cout<<"Try using different credit card \n"<<endl;
goto cred;
}
formula = fb - expenses;
cout<<"The price you must pay is: "<<expenses<<"\n"<<endl;
cout<<"Your credit card Has remaining: "<<fb<<" "<<"Peso"<<"Balance"<<"\n"<<endl;
cout<<"Your credit Balance now is : "<<formula<<" "<<"Pesos"<<"\n "<<endl;
cout<<"\n"<<endl;
cout<<"Congratulations! Here's your key and Enjoy your stay! \n"<<endl;
}
else{
cout<<"The price you must pay is:"<<expenses<<"Pesos"<<endl;
cout<<"\n"<<endl;
sys:
cout<<"Enter your cash: ";
cin>>cash;
cout<<"We have received your cash and it is: "<<cash<<" "<<"Pesos"<<"\n"<<endl;
form = cash - expenses;
break;
case 2:
cout<<"You selected Econo Type \n"<<endl;
cout<<"Here is the brief information about this room. \n"<<endl;
cout<<"The Econo room, is a well-appointed room perfect for a single guest."<<"\n"<<"The
bedroom is very comfortable and includes bed concept.\nThe room is air conditioned, and has a
flat LCD TV \nThe bathroom is equipped with shower facilities.\nThe size of the room is
16sqm."<<endl;
if (choice == 1){
cout<<"May we have your credit card so we can process your Transaction \n"<<endl;
crd:
cout<<"Enter Card Number: "; // Card desc.
cin>>a;
cout<<"\n"<<endl;
srand (time(NULL));
b = (rand()*1)*a;
fb = b;
cout<<"Credit card holder Code is:PM-13-0957"<<a<<"\n"<<endl;
if(expenses > fb){
cout<<"We''re sorry but you dont have enough Balance \n"<<endl;
cout<<"Try using different credit card \n"<<endl;
goto crd;
}
formula = fb - expenses;
cout<<"The price you must pay is:"<<expenses<<"Pesos"<<"\n"<<endl;
cout<<"Your credit card Has remaining:"<<fb<<" "<<"Peso"<<"Balance"<<"\n"<<endl;
cout<<"Your credit Balance now is :"<<formula<<" "<<"Pesos"<<"\n "<<endl;
cout<<"\n"<<endl;
cout<<"Thankyou! Here's your key and Enjoy your stay! Have a nice day! \n"<<endl;
}
else{
cout<<"The price you must pay is:"<<expenses<<endl;
cout<<"\n"<<endl;
syz:
cout<<"Enter your cash: ";
cin>>cash;
cout<<"We have received your cash and it is:"<<cash<<"Pesos"<<"\n"<<endl;
form = cash - expenses;
}
break;
//case 3
case 3:
cout<<"You selected Family Type \n"<<endl;
cout<<"Here is the brief information about this room. \n"<<endl;
cout<<"A room built just for families, now there's a novel concept. \n"<<endl;
cout<<"The family room comes with bunk beds for the kiddies\nWith even has cute themed
bedding!\nGet some free gifts and dental kits to keep the little ones smiling\nTo keep those
smiles bright.\nThe price of Family Type room is: 10000 Pesos \n"<<endl;
cout<<"How many nights would you like to stay?: ";
cin>>stay;
cout<<"\n"<<endl;
if(stay <= 0){
cout<<"Error Number of Stay, Must be Atleast 1 Day! \n"<<endl;
}
if(stay>=1)
expenses = 10000 * stay;
cout<<"The total expenses will be:"<<" "<<expenses<<" "<<"Pesos"<<"\n"<<endl;
ecv:
cout<<"Choose Payment Method \n"<<endl;
cout<<"Press 1 if credit card\nPress 2 if cash\nPayment Method: ";
cin>>choice;
if (choice == 1){
cout<<"May we have your credit card so we can process your Transaction \n"<<endl;
cra:
cout<<"Enter Card Number: "; // name and balance of card
cin>>a;
cout<<"\n"<<endl;
srand (time(NULL));
b = (rand()*1)*a;
fb = b;
cout<<"Credit card holder Code is:PM-13-0957"<<a<<"\n"<<endl;
if(expenses > fb){
cout<<"We're sorry but you dont have enough Balance \n"<<endl;
cout<<"Try using different credit card \n"<<endl;
goto cra;
}
formula = fb - expenses;
cout<<"The price you must pay is:"<<expenses<<"Pesos"<<"\n"<<endl;
cout<<"Your credit card Has remaining:"<<fb<<" "<<"Peso"<<"Balance"<<"\n"<<endl;
cout<<"Your credit Balance now is :"<<formula<<" "<<"Pesos"<<"\n "<<endl;
cout<<"\n"<<endl;
cout<<"Congratulations! Here's your key and Enjoy your stay! \n"<<endl;
}
else{
cout<<"The price you must pay is:"<<expenses<<"Pesos"<<endl;
cout<<"\n"<<endl;
syn:
cout<<"Enter your cash: ";
cin>>cash;
cout<<"We have received your cash and it is:"<<cash<<" "<<"Pesos"<<"\n"<<endl;
form = cash - expenses;
if (choice == 1){
cout<<"May we have your credit card so we can process your Transaction \n"<<endl;
crap:
cout<<"Enter Card Number: "; // name and balance of card
cin>>a;
cout<<"\n"<<endl;
srand (time(NULL));
b = (rand()*1)*a;
fb = b;
cout<<"Credit card holder Code is:PM-13-0957"<<a<<"\n"<<endl;
if(expenses > fb){
cout<<"We're' sorry but you dont have enough Balance \n"<<endl;
cout<<"Try using different credit card \n"<<endl;
goto crap;
}
formula = fb - expenses;
cout<<"The price you must pay is:"<<expenses<<"Pesos"<<"\n"<<endl;
cout<<"Your credit card Has remaining:"<<fb<<" "<<"Peso"<<"Balance"<<"\n"<<endl;
cout<<"Your credit Balance now is :"<<formula<<" "<<"Pesos"<<"\n "<<endl;
cout<<"\n"<<endl;
cout<<"Thankyou! Here's your key and Enjoy your stay! have a nice day! \n"<<endl;
}
else{
cout<<"The price you must pay is:"<<expenses<<"Pesos"<<endl;
cout<<"\n"<<endl;
syns:
cout<<"Enter your cash: ";
cin>>cash;
cout<<"We have received your cash and it is:"<<cash<<"Pesos"<<"\n"<<endl;
form = cash - expenses;
}
break;
case 5:
cout<<"Thank you for visiting Leonardo & Alviento's Hotel Managing System!"<<endl;
return 0;
default:{
cout<<"Error Choice, It must be from 1-5 only \n"<<endl;
cout<<"Have a nice day!"<<endl;
goto menu;
cout<<"\n"<<endl;
}
}
system("PAUSE");
return 0;
}
b) Output
1)
2)
3)
4)
5)
IV. BUILT-IN FUNCTIONS USED
The Built-In Function we used are:
Data type Integer
Switch
Do-while loop
If and else statements
Go to function
Break
Return
and Default function.
V. REFERENCES
The references we used for this system are https://isocpp.org/, C++ Programming (Problem
analysis to program design) By: D.S Malik, and en.cppreference.com/.