Machine Project Documentation CS10-1L: Hotel Accommodation System
Machine Project Documentation CS10-1L: Hotel Accommodation System
CS10-1L
Submitted by:
Sy, Royce John I.
Directo, Giovani O.
Pascua, Arvin Joseph S.
Submitted to:
Engr. Cheryl Mari M. Isip
3rd Q/2014-2015
Declaration of Originality of Work
GIOVANI O. DIRECTO
Name and Signature
Machine Project Description:
This program allows the user to choose the type of room he/she wants to stay in a hotel.
After choosing, the program will show the description of the chosen room and the
price/day. The user will then input the number of days he/she will stay; this will be
multiplied to the price for the user to know the total cost. It will then let the user pick the
type of payment he/she wants to make, either credit or cash. If credit, the user has to
input his/her credit card number and the program will then show the balance of the
credit card and the balance after reducing it with the payment. If the user chose to pay
in cash, it will then make the user input the amount he/she will pay and the change
he/she will receive.
Problem Statement:
Write a program that lets the user choose the type of room in a hotel. After choosing, it
will output the description of the room and the price/day. The user will then input a
number greater than zero as the number of days he will stay which will be multiplied to
the price of the room. If the user input a number less than or equal to 0 then the
program will loop to the first question and ask the user again.
After the user inputs the correct value, the program will ask the user the method of
payment, either credit or cash. If credit, the program will ask for the credit card number
and it will show the initial balance and the final balance, in which the Final Balance =
Initial Balance – (price*no of days he will stay). If cash, it will then make the user input
the amount he/she will pay and the change he/she will receive but if the payment is less
than the amount to pay the program will loop and ask the user to input another amount.
Design
a. Algorithm – Before our group created the program, we listed the things that we
must consider in making this program, we conducted a research about the Room
types, how do they pay and we also considered the mode of payment the user
will use. In terms of formula formulation what we did was we just subtracted the
number of stay to the user’s current cash or credit cards balance.
Here is the flowchart of our program for the viewer’s better understanding:
Start/
Start/Menu
Menu
Desired Room
Input
Selection < 6
F
Selection==1 Room Info No. of Stay No. of Stay Error!
!=0
Payment Method
Selection==2
Input
T T
Selection==4 T
Input ==1 Enter card no. Input Formula Price Price>Card
Error!
F F
F
T Balance
Selection==5 T
Input ==2 Enter Cash Input Formula Cash>Exp
T Formula
Cash
Start/ Remaining
Stop
Menu
Total Cash
Start/
Stop
Menu
Exit
b. Source Code
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <time.h>
using namespace std;
int main()
{
int selection;
int form;
int a;
int b;
int stay;
int expenses;
int choice;
int cash;
int formula;
do{
menu:
cout<<"Press 1 for Suite Type Room \n"<<endl;
cout<<"Press 2 for Econo Type Room \n"<<endl;
cout<<"Press 3 for Family Type Room \n"<<endl;
cout<<"Press 4 for Studio Type Room \n"<<endl;
cout<<"Press 5 for Checkout and exit \n"<<endl;
cout<<"Choose your Desired Room Type: ";
cin>>selection;
cout<<"\n"<<"\n"<<endl;
if (choice == 1){
cout<<"May i have your Debit 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<<"Im sorry but you dont have enough Balance \n"<<endl;
cout<<"Try using different debit card \n"<<endl;
goto cred;
}
formula = fb - expenses;
cout<<"The price you must pay is: "<<expenses<<"\n"<<endl;
cout<<"Your debit 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<<"I 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 \n
"<<endl;
cout<<"The 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 i have your Debit 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<<"Im sorry but you dont have enough Balance \n"<<endl;
cout<<"Try using different debit card \n"<<endl;
goto crd;
}
formula = fb - expenses;
cout<<"The price you must pay is:"<<expenses<<"Pesos"<<"\n"<<endl;
cout<<"Your debit 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<<endl;
cout<<"\n"<<endl;
syz:
cout<<"Enter your cash: ";
cin>>cash;
cout<<"I 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!"<<"\n"<<"Get some free gifts and dental kits to keep the little
ones smiling\nTo keep those smiles bright.\n"<<endl;
cout<<"The price of Family Type room is: 10000 Pesos \n"<<endl;
rp:cout<<"\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;
goto rp;
}
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 debit card:\nPress 2 if cash: ";
cin>>choice;
if (choice == 1){
cout<<"May i have your Debit 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<<"Im sorry but you dont have enough Balance \n"<<endl;
cout<<"Try using different debit card \n"<<endl;
goto cra;
}
formula = fb - expenses;
cout<<"The price you must pay is:"<<expenses<<"Pesos"<<"\n"<<endl;
cout<<"Your debit 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<<"I have received your cash and it is:"<<cash<<" "<<"Pesos"<<"\n"<<endl;
form = cash - expenses;
if (choice == 1){
cout<<"May i have your Debit 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<<"Im sorry but you dont have enough Balance \n"<<endl;
cout<<"Try using different debit card \n"<<endl;
goto crap;
}
formula = fb - expenses;
cout<<"The price you must pay is:"<<expenses<<"Pesos"<<"\n"<<endl;
cout<<"Your debit 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;
syns:
cout<<"Enter your cash: ";
cin>>cash;
cout<<"I have received your cash and it is:"<<cash<<"Pesos"<<"\n"<<endl;
form = cash - expenses;
}
break;
case 5:
return EXIT_SUCCESS;
default:{
cout<<"Error Choice, It must be from 1-4 only \n"<<endl;
cout<<"Have a nice day!"<<endl;
goto menu;
cout<<"\n"<<endl;
}
}
system("PAUSE");
return EXIT_SUCCESS;
}
References:
The references we used in making this program are C++ Programming (Problem
analysis to program design) By: D.S Malik and the other book we used as our basis for
syntaxes is Programming in C (3rd Edition) By: Stephen G. Kochan
Group Contributions:
Display of the
Sy, Royce John I. SY_PROJECT.cpp
Program
Looping and
Sy, Royce John I. SY_PROJECT.cpp
Compilation
Display of the
Pascua, Arvin Joseph S. PASCUA_PROJECT.cpp
Program
Display of the
Directo, Giovani O. DIRECTO_PROJECT.cpp
Program