0% found this document useful (0 votes)
62 views26 pages

CSC-126 (Asessment)

This document contains code for a C++ program that allows a user to book a room at an L Residence Vacation Home. It asks the user to enter their name, pet name, and pet type. Based on the pet type, it presents different room options with prices. It then allows the user to add extra services and enter check-in/out dates. It calculates the total price.

Uploaded by

ris
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views26 pages

CSC-126 (Asessment)

This document contains code for a C++ program that allows a user to book a room at an L Residence Vacation Home. It asks the user to enter their name, pet name, and pet type. Based on the pet type, it presents different room options with prices. It then allows the user to add extra services and enter check-in/out dates. It calculates the total price.

Uploaded by

ris
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

/*

NAME : MUHAMMAD HARIS BIN MUHMAT HILME


DATE : 10/12/2022
PROGRAM TITLE : L Residence Vacation Home
*/

#include <iostream>
using namespace std;
int main ()
{
cout<<"\nWelcome to L Residence Vacation Home\n"<<endl;

int room, date_checkin, date_checkout, extraservice;


string owner_name, pet_type, pet_name, cat, dog,
small_animal, ex_service, y="yes", n="no", day_checkin,
day_checkout, month_checkin, month_checkout, loop, roomtype;
double price, exprice= 0,totalprice;

//INPUT
cout<<"Please enter your name:";
getline(cin, owner_name);
cout<<"Enter your pet's name:";
getline(cin, pet_name);
cout<<"Enter your pet type:";
getline(cin, pet_type);

if(pet_type == "cat"|| pet_type == "Cat" || pet_type ==


"CAT")
{
cout<<"\n////////////////////////////////"<<endl;
cout<<endl<<" Our room suite"<<endl;
cout<<"----------------"<<endl;

cout<<"\n1. Savannah (RM 130)"<<endl;


cout<<"2. Beachcombers (RM 150)"<<endl;
cout<<"3. Malibu (RM 180)"<<endl;
cout<<"4. Royal mews (RM 200)\n"<<endl;

cout<<"choose room type :";


cin>>room;

if(room==1){
cout<<"[You have booked the Savannah suite]"<<endl;
roomtype="The Savannah suite";
}

else if(room==2){
cout<<"[You have booked the Beachcombers
suite]"<<endl;
roomtype="The Beachcombers suite";
}

else if(room==3){
cout<<"[You have booked the Malibu suite] "<<endl;
roomtype="The Malibu suite";
}

else {
cout<<"[You have booked the Royal mews suite]"<<endl;
roomtype="The Royal Mews suite";
}

if (room == 1 )
price = 130;
else if (room == 2)
price = 150;
else if (room == 3)
price = 180;
else
price = 200;

cout<<"\n////////////////////////////////"<<endl;
cout<<endl<<" Extra services"<<endl;
cout<<"----------------"<<endl;

cout<<"\n1. Fine dining menu (RM 50)"<<endl;


cout<<"2. Chauffeur service (RM 50)"<<endl;
cout<<"3. Flea & tick prevention (RM 50)"<<endl;

cout<<"\nwould you like to add an extra service?


(yes/no):";
cin>>ex_service;

if(ex_service == y)
{

loop=y;
while(loop == y)
{

cout<<"Choose what extra service you want :";


cin>>extraservice;

//additional extra service


if(extraservice == 1){
cout<<"(You have add the fine dining menu
service)"<<endl;
exprice=exprice + 50;
}

else if(extraservice == 2){


cout<<"(You have add Chauffeur service)"<<endl;
exprice=exprice + 50;
}

else if(extraservice == 3){


cout<<"(You have add the Flea & tick prevention
service)"<<endl;
exprice=exprice + 50; }
cout<<"\nwould you like to add another extra
service? (yes/no):";
cin>>loop;
}
// CHECK-IN AND CHECKOUT
cout<<"\n////////////////////////////////"<<endl;
cout<<endl<<"Enter check-in day:";
cin>>day_checkin;
cout<<"Enter checkout day:";
cin>>day_checkout;

cout<<endl<<"Enter check-in date :";


cin>>date_checkin;
cout<<"Enter check-in month :";
cin>>month_checkin;
cout<<"Enter checkout date :";
cin>>date_checkout;
cout<<"Enter checkout month :";
cin>>month_checkout;

//OUTPUT
price=price*(date_checkout - date_checkin + 1);
exprice=exprice*(date_checkout - date_checkin +
1);
totalprice=exprice + price;

if(ex_service == n){

// CHECK-IN AND CHECKOUT

cout<<"\n////////////////////////////////"<<endl;
cout<<endl<<"Enter check-in day:";
cin>>day_checkin;
cout<<"Enter checkout day:";
cin>>day_checkout;

cout<<endl<<"Enter check-in date :";


cin>>date_checkin;
cout<<"Enter check-in month :";
cin>>month_checkin;
cout<<"Enter checkout date :";
cin>>date_checkout;
cout<<"Enter checkout month :";
cin>>month_checkout;

//OUTPUT
price=price*(date_checkout - date_checkin + 1);
totalprice=price;

}
}

//DOG

if(pet_type == "dog" || pet_type=="Dog" ||


pet_type=="DOG")
{
cout<<"\n////////////////////////////////"<<endl;
cout<<endl<<" Our room suite"<<endl;
cout<<"----------------"<<endl;
cout<<"\n1. Playpen (RM 100)"<<endl;
cout<<"2. Sky suite (RM 130)"<<endl;
cout<<"3. Meadow suite (RM 150)"<<endl;
cout<<"4. Club suite (RM 200)\n"<<endl;

cout<<"choose room type :";


cin>>room;

if(room==1){
cout<<"\nYou have booked the Playpen suite"<<endl;
roomtype="The Playpen suite";
}

else if(room==2){
cout<<"\nYou have booked the Sky suite"<<endl;
roomtype="The sky suite";
}

else if(room==3){
cout<<"\nYou have booked the Meadow suite "<<endl;
roomtype="The Meadow suite";
}

else {
cout<<"\nYou have booked the Club suite"<<endl;
roomtype="The Club suite";
}
if (room == 1 )
price = 100;
else if (room == 2)
price = 130;
else if (room == 3)
price = 150;
else
price = 200;

cout<<"\n////////////////////////////////"<<endl;
cout<<endl<<" Extra services"<<endl;
cout<<"----------------"<<endl;

cout<<"\n1. Fine dining menu (RM 50)"<<endl;


cout<<"2. Chauffeur service (RM 50)"<<endl;
cout<<"3. Flea & tick prevention (RM 50)"<<endl;

cout<<"\nwould you like to add an extra service?


(yes/no):";
cin>>ex_service;

if(ex_service == y)
{

loop=y;

while(loop == y)
{
cout<<"Choose what extra service you want :";
cin>>extraservice;

//additional extra service


if(extraservice == 1){
cout<<"[You have add the fine dining menu
service]"<<endl;
exprice=exprice + 50;
}

else if(extraservice == 2){


cout<<"[You have add Chauffeur service]"<<endl;
exprice=exprice + 50;
}

else if(extraservice == 3){

cout<<"[You have add the Flea & tick prevention


service]"<<endl;
exprice=exprice + 50; }

cout<<"\nwould you like to add another extra


service? (yes/no):";
cin>>loop;
}
// CHECK-IN AND CHECKOUT
cout<<"\n////////////////////////////////"<<endl;
cout<<endl<<"Enter check-in day:";
cin>>day_checkin;
cout<<"Enter checkout day:";
cin>>day_checkout;
cout<<endl<<"Enter check-in date :";
cin>>date_checkin;
cout<<"Enter check-in month :";
cin>>month_checkin;
cout<<"Enter checkout date :";
cin>>date_checkout;
cout<<"Enter checkout month :";
cin>>month_checkout;

//OUTPUT

price=price*(date_checkout - date_checkin + 1);


exprice=exprice*(date_checkout - date_checkin +
1);
totalprice=exprice + price;

if(ex_service == n){

// CHECK-IN AND CHECKOUT


cout<<"\n////////////////////////////////"<<endl;
cout<<endl<<"Enter check-in day:";
cin>>day_checkin;
cout<<"Enter checkout day:";
cin>>day_checkout;

cout<<endl<<"Enter check-in date :";


cin>>date_checkin;
cout<<"Enter check-in month :";
cin>>month_checkin;
cout<<"Enter checkout date :";
cin>>date_checkout;
cout<<"Enter checkout month :";
cin>>month_checkout;

//OUTPUT

price=price*(date_checkout - date_checkin + 1);


totalprice=price;

}
}

//SMALL ANIMAL, BIRD OR REPTILE

if(pet_type == "small animal" || pet_type == "bird" ||


pet_type == "reptile")
{
cout<<"\n////////////////////////////////"<<endl;
cout<<endl<<" Our room suite"<<endl;
cout<<"----------------"<<endl;
cout<<"\n1. With cage (RM 70)"<<endl;
cout<<"2. Without cage (RM 90)"<<endl;

cout<<"\nchoose room type :";


cin>>room;

if(room==1){
cout<<"\nYou have booked the with cage suite"<<endl;
roomtype="The with cage suite";
}

else {
cout<<"\nYou have booked the without cage
suite"<<endl;
roomtype="The Without cage suite";
}

if (room == 1 )
price = 70;
else
price = 90;

cout<<"\n////////////////////////////////"<<endl;
cout<<endl<<" Extra services"<<endl;
cout<<"----------------"<<endl;

cout<<"\n1. Pet music therapy (RM


50)"<<endl;
cout<<"2. Free playtime with supervise (RM 50)"<<endl;
cout<<"\nwould you like to add an extra service?
(yes/no):";
cin>>ex_service;

if(ex_service == y)
{

loop=y;

while(loop == y)
{

cout<<"\nChoose what extra service you want :";


cin>>extraservice;

//additional extra service


if(extraservice == 1){
cout<<"[You have add the Pet music therapy
service]"<<endl;
exprice=exprice + 10;
}

else if(extraservice == 2){

cout<<"[You have add the Free playtime with


supervise service]"<<endl;
exprice=exprice + 10; }

cout<<"\nwould you like to add another extra


service? (yes/no):";
cin>>loop;
}

// CHECK-IN AND CHECKOUT


cout<<"\n////////////////////////////////"<<endl;
cout<<endl<<"Enter check-in day:";
cin>>day_checkin;
cout<<"Enter checkout day:";
cin>>day_checkout;

cout<<endl<<"Enter check-in date :";


cin>>date_checkin;
cout<<"Enter check-in month :";
cin>>month_checkin;
cout<<"Enter checkout date :";
cin>>date_checkout;
cout<<"Enter checkout month :";
cin>>month_checkout;

//OUTPUT

price=price*(date_checkout - date_checkin + 1);


exprice=exprice*(date_checkout - date_checkin +
1);
totalprice=exprice + price;

}
if(ex_service == n){

// CHECK-IN AND CHECKOUT


cout<<"\n////////////////////////////////"<<endl;
cout<<endl<<"Enter check-in day:";
cin>>day_checkin;
cout<<"Enter checkout day:";
cin>>day_checkout;

cout<<endl<<"Enter check-in date :";


cin>>date_checkin;
cout<<"Enter check-in month :";
cin>>month_checkin;
cout<<"Enter checkout date :";
cin>>date_checkout;
cout<<"Enter checkout month :";
cin>>month_checkout;

//OUTPUT

price=price*(date_checkout - date_checkin + 1);


totalprice=price;

}
}

//OUTPUT
cout<<"\n------------------------------------------
------------------------"<<endl;
cout<<"\nYOUR RECEIPT"<<endl;
cout<<"-------------"<<endl;
cout<<"\n";
cout<<"Name of the owner
:"<<owner_name<<endl;
cout<<"Pet type :"<<pet_type<<endl;
cout<<"Pet's name :"<<pet_name<<endl;
cout<<"Room type/suite :"<<roomtype<<endl;
cout<<"Check-in day
:"<<day_checkin<<endl;
cout<<"Check-out day
:"<<day_checkout<<endl;
cout<<"Check-in date
:"<<date_checkin<<"/"<<month_checkin<<endl;
cout<<"Check-out date
:"<<date_checkout<<"/"<<month_checkout<<endl;
cout<<"your original price :"<<"RM
"<<price<<endl;
cout<<"your extra service price:"<<"RM
"<<exprice<<endl;
cout<<"Your total price is :"<<"RM
"<<totalprice<<endl;
cout<<"\n[ 6% Government service tax ]"<<endl;
cout<<"\nYour new total price is :"<<"RM "<<
totalprice+(totalprice*0.06)<<endl;
cout<<"\nThank You And Come Again ;)";

return 0;
}
Welcome to L Residence Vacation Home

Please enter your name:Haris

Enter your pet's name:Moochie

Enter your pet type:Cat

////////////////////////////////

Our room suite

----------------

1. Savannah (RM 130)

2. Beachcombers (RM 150)

3. Malibu (RM 180)

4. Royal mews (RM 200)

choose room type :1

[You have booked the Savannah suite]

////////////////////////////////

Extra services

----------------

1. Fine dining menu (RM 50)

2. Chauffeur service (RM 50)

3. Flea & tick prevention (RM 50)

would you like to add an extra service? (yes/no):yes

Choose what extra service you want :1

(You have add the fine dining menu service)


would you like to add another extra service? (yes/no):yes

Choose what extra service you want :2

(You have add Chauffeur service)

would you like to add another extra service? (yes/no):yes

Choose what extra service you want :3

(You have add the Flea & tick prevention service)

would you like to add another extra service? (yes/no):no

////////////////////////////////

Enter check-in day:Monday

Enter checkout day:Thursday

Enter check-in date :24

Enter check-in month :November

Enter checkout date :28

Enter checkout month :November

------------------------------------------------------------------

YOUR RECEIPT

-------------

Name of the owner :Haris

Pet type :Cat

Pet's name :Moochie

Room type/suite :The Savannah suite

Check-in day :Monday


Check-out day :Thursday

Check-in date :24/November

Check-out date :28/November

your original price :RM 650

your extra service price:RM 750

Your total price is :RM 1400

[ 6% Government service tax ]

Your new total price is :RM 1484

Thank You And Come Again ;)


//Input
- Name
- Pet’s name
- Pet type
- Room type
- Day check-in
- Day checkout
- Date check-in
- Month check-in
- Date checkout
- Month checkout
- Extra service

//OUTPUT
- Name of the owner
- Pet type
- Pet's name
- Room type/suite
- Check-in day
- Check-out day
- Check-in date
- Check-out date
- your original price
- your extra service price
- Your total price is
- Your new total price is

You might also like