Wednesday 30 December 2015

Assignment programming (Hotel's room reservation)

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

void option();
void reserve();
void change();
float level1();
float level2();
void cancel();
void bill();
void bill2(int,int,int,int,int);
void end();

int main()
{
system("title BoraBora Hotel");
char name[100];
int number[100];
int phonenumber[100];
system("color E9");
   printf("\n                              :::::::::::::::::::::::::::::::::::::");
   printf("\n                              ::                                 ::");
   printf("\n                              ::     @@@@@@@@@@@@@@@@@@@@@@@     ::");
   printf("\n                              ::     @                     @     ::");
   printf("\n                              ::     @      WELCOME TO     @     ::");
   printf("\n                              ::     @                     @     ::");
   printf("\n                              ::     @    BORABORA HOTEL   @     ::");
   printf("\n                              ::     @                     @     ::");
   printf("\n                              ::     @@@@@@@@@@@@@@@@@@@@@@@     ::");
   printf("\n                              ::                                 ::");
   printf("\n                              :::::::::::::::::::::::::::::::::::::    \n\n");
   printf("                      ************* Hotel Room Booking System *************\n\n");//decoration.nama HOTEL!!!//


printf("                               WELCOME TO BORABORA ISLAND HOTEL !!    \n\n\t\t\t           WE ARE READY TO SERVE YOU\n\n");

printf("\n\nPlease enter your name:");
scanf("%s",name);
printf("Please enter NIC Number:");
scanf("%d",&number);
printf("Please enter your phone number:");
scanf("%d",&phonenumber);

printf("\nHi Miss/Mr %s\n\n",name);

option(name);


system("pause");
return 0;
}

void option()
{

int choose;


    printf("\t(1) Make a reservation\n");
printf("\t(2) Change Date\n");
printf("\t(3) Cancel Reservation\n");
printf("\t(4) Print Bill\n");
printf("\t(5) Exit\n\n");

printf("Please make your choice:");
scanf("%d",&choose);
printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n");

switch(choose)
{
   case 1: reserve();break;
case 2: change();break;
case 3: cancel();break;
case 4: bill();break;
case 5: end();break;

default:break;

}
}

void reserve()
{
system("cls");
system("color C0 ");
float x;
int room1,level;
srand(time(NULL));
int randNo;
int room,roomtype;
int date[100],date1[100];

printf("Your choice is (1)\n\n\n");
printf("3 options of room type:\n\n");
printf("\t<1> Junior Suite= RM 250.00 per night\n");
printf("\t<2> Superior Suite= RM 550.00 per night\n");
printf("\t<3> Executive Suite= RM 750.00 per night\n\n");

printf("Choose your room type:");
scanf("%d",&room1);
//availability,room no-pKairandom no,//
if(room1==1)
 {
        int b;
float junior=250.00;
   printf("\nYour room type is Junior Suite\n\n");
 
     printf("Your booking date?\n\n");
     printf("Check-in:\nDay:");
     scanf("%d",&date[0]);
     printf("Month:");
     scanf("%d",&date[1]);
     printf("Year:");
     scanf("%d",&date[2]);
   


     printf("\nCheck-out:\nDay:");
     scanf("%d",&date1[0]);
     printf("Month:");
     scanf("%d",&date1[1]);
     printf("Year:");
     scanf("%d",&date1[2]);
   

     printf("\n\nYour date is %d-%d-%d until",date[0],date[1],date[2]);
     printf(" %d-%d-%d\n\n",date1[0],date1[1],date1[2]);


     printf("Do you want to see the reserved and unreserved room?\n\n");
     printf("(1)-YES\n");
printf("(2)-NO\n");
     printf("Options:");
     scanf("%d",&b);
     if(b==1)
      {
      printf("\nwhich level do you prefer?\n");
        scanf("%d",&level);

        if(level==1)
        x=level1(level);

        else if(level==2)
        x=level2(level);

     printf("\n\nYou have chosen Junior Suite as your room. Your date is %d-%d-%d until",date[0],date[1],date[2]);
     printf(" %d-%d-%d. Your room is %.1f. Wait for your bill Mr/Miss. Enjoy!\n\n",date1[0],date1[1],date1[2],x);
      }
 else
 {

      randNo=1+rand()%(100-1+1);
      printf("\n\nYour room number will be %d\n\n",randNo);
   
      printf("Kindly call us if there's any enquiries.Thank you!\n\n");
      printf("Enjoy your holiday!!\n\n");
   
   
      printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n");
      }
sleep(6);
bill2(date[0],date1[0],date[1],date1[1],junior);
 }
else if(room1==2)
 {
  int b;
  float superior=550.00;
  printf("Your room type is Superior Suite\n\n");
 
     printf("Your booking date?\n\n");
     printf("Check-in:\nDay:");
     scanf("%d",&date[0]);
     printf("Month:");
     scanf("%d",&date[1]);
     printf("Year:");
     scanf("%d",&date[2]);
   


     printf("\nCheck-out:\nDay:");
     scanf("%d",&date1[0]);
     printf("Month:");
     scanf("%d",&date1[1]);
     printf("Year:");
     scanf("%d",&date1[2]);
   
      printf("\n\nyour date is %d-%d-%d until",date[0],date[1],date[2]);
      printf(" %d-%d-%d\n",date1[0],date1[1],date1[2]);
   
         printf("Do you want to see the reserved and unreserved room?\n\n");
     printf("(1)-YES\n");
printf("(2)-NO\n");
     printf("Options:");
     scanf("%d",&b);
     if(b==1)
      {
      printf("\nwhich level do you prefer?\n");
        scanf("%d",&level);

        if(level==1)
        x=level1(level);

        else if(level==2)
        x=level2(level);

     printf("\n\nYou have chosen Superior Suite as your room. Your date is %d-%d-%d until",date[0],date[1],date[2]);
     printf(" %d-%d-%d. Your room is %.1f.Wait for your bill Mr/Miss. Enjoy!\n\n",date1[0],date1[1],date1[2],x);
      }
 else
 {

      randNo=1+rand()%(100-1+1);
      printf("\n\nYour room number will be %d\n\n",randNo);
   
      printf("Kindly call us if there's any enquiries.Thank you!\n\n");
      printf("Enjoy your holiday!!\n\n");
   
   
      printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n");
      }
      sleep(6);
     bill2(date[0],date1[0],date[1],date1[1],superior);
 }
else if(room1==3)
 {
  int b;
  float executive=750.00;
  printf("Your room type is Executive Suite\n\n");

     printf("Your booking date?\n\n");
     printf("Check-in:\nDay:");
     scanf("%d",&date[0]);
     printf("Month:");
     scanf("%d",&date[1]);
     printf("Year:");
     scanf("%d",&date[2]);
   


     printf("\nCheck-out:\nDay:");
     scanf("%d",&date1[0]);
     printf("Month:");
     scanf("%d",&date1[1]);
     printf("Year:");
     scanf("%d",&date1[2]);
   

      printf("\n\nyour date is %d-%d-%d until",date[0],date[1],date[2]);
      printf(" %d-%d-%d\n",date1[0],date1[1],date1[2]);
 
         printf("Do you want to see the reserved and unreserved room?\n\n");
     printf("(1)-YES\n");
printf("(2)-NO\n");
     printf("Options:");
     scanf("%d",&b);
     if(b==1)
      {
      printf("\nwhich level do you prefer?\n");
        scanf("%d",&level);

        if(level==1)
        x=level1(level);

        else if(level==2)
        x=level2(level);

     printf("\n\nYou have chosen Executive Suite as your room. Your date is %d-%d-%d until",date[0],date[1],date[2]);
     printf(" %d-%d-%d. Your room is %.1f.Wait for your bill Mr/Miss. Enjoy!\n\n",date1[0],date1[1],date1[2],x);
      }
 else
 {

      randNo=1+rand()%(100-1+1);
      printf("\n\nYour room number will be %d\n\n",randNo);
   
      printf("Kindly call us if there's any enquiries.Thank you!\n\n");
      printf("Enjoy your holiday!!\n\n");
   
   
      printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n");
      }
      sleep(6);
bill2(date[0],date1[0],date[1],date1[1],executive);
 }

}

void change()
{
system("cls");
system("color A6");
int randNo;
srand(time(NULL));
int date[100],date1[100];
printf("Your choice is (2)\n\n\n");

      printf("Your booking date?\n\n");
     printf("Check-in:\nDay:");
     scanf("%d",&date[0]);
     printf("Month:");
     scanf("%d",&date[1]);
     printf("Year:");
     scanf("%d",&date[2]);
   


     printf("\nCheck-out:\nDay:");
     scanf("%d",&date1[0]);
     printf("Month:");
     scanf("%d",&date1[1]);
     printf("Year:");
     scanf("%d",&date1[2]);

      printf("\n\nyour new date is %d-%d-%d until",date[0],date[1],date[2]);
      printf(" %d-%d-%d\n",date1[0],date1[1],date1[2]);

      randNo=1+rand()%(100-1+1);
      printf("Your room number will be %d\n\n",randNo);
   

      printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n");

      option();

}

void cancel()
{
system("cls");
system("color F3");
int x;
printf("Your choice is (3)\n\n\n");

 printf("Do you want to cancel your reservation?\n\n");
 printf("(1)-YES\n");
 printf("(2)-NO\n");
      printf("Options:");
      scanf("%d",&x);
    if(x==1)
    {
      printf("Your reservation is cancelled\nThank you for your cooperation\nPlease come again =)\n");
      printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n");
}
else
{
      printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n");
      option();
    }
}

void bill2(int a,int b,int c,int d,int e)
{
system("cls");
int day,month,total=0;
float payment;
day=b-a;
month=(d-c)*30;
total=day+month;
payment=(float)total*e;
printf("Your total payment is RM%0.2f\nyour deposit is included.\n",payment);
printf("Deposit=RM50.00\nYou will get your deposit back right after your check out\n\n\n");
}


 

float level1(level)
{
system("cls");
int room;
float x;
printf("\nYou have chosen level %d.\n\n",level);
 printf("\nNo\t\tRoom No\t\t\t\t\tAvailability\n\n");
 printf("1\t\t1.1\t\t\t\t\tAvailable\n");
 printf("2\t\t1.2\t\t\t\t\tAvailable\n");
 printf("3\t\t1.3\t\t\t\t\tAvailable\n");
 printf("4\t\t1.4\t\t\t\t\tUnavailable\n");
 printf("5\t\t1.5\t\t\t\t\tAvailable\n");
 printf("6\t\t1.6\t\t\t\t\tAvailable\n");
      printf("7\t\t1.7\t\t\t\t\tUnavailable\n");
 printf("8\t\t1.8\t\t\t\t\tUnavailable\n");
 printf("9\t\t1.9\t\t\t\t\tAvailable\n");
 printf("10\t\t1.10\t\t\t\t\tUnavailable\n");
 printf("\n\nPlease enter the number which room is available:");
 scanf("%d",&room);

switch(room)
{
case 1:printf("\nIt is available");return x=1.1;
case 2:printf("\nIt is available");return x=1.2;
case 3:printf("\nIt is available");return x=1.3;
case 4:printf("\nsorry Miss/Mr. The room is unavailable. Please re-choose.");reserve();
case 5:printf("\nIt is available");return x=1.5;
case 6:printf("\nIt is available");return x=1.6;
case 7:printf("\nsorry Miss/Mr. The room is unavailable. Please re-choose.");reserve();
case 8:printf("\nsorry Miss/Mr. The room is unavailable. Please re-choose.");reserve();
case 9:printf("\nIt is available");return x=1.9;
case 10:printf("\nsorry Miss/Mr. The room is unavailable. Please re-choose.");reserve();
}
}

float level2(level)
{
system("cls");
int room;
float x;
printf("\nYou have chosen level %d.\n\n",level);
 printf("\nNo\t\tRoom No\t\t\t\t\tAvailability\n\n");
 printf("1\t\t\2.1\t\t\t\t\tAvailable\n");
 printf("2\t\t2.2\t\t\t\t\tAvailable\n");
 printf("3\t\t2.3\t\t\t\t\tAvailable\n");
 printf("4\t\t2.4\t\t\t\t\tUnavailable\n");
 printf("5\t\t2.5\t\t\t\t\tAvailable\n");
 printf("6\t\t2.6\t\t\t\t\tAvailable\n");
 printf("7\t\t2.7\t\t\t\t\tUnavailable\n");
 printf("8\t\t2.8\t\t\t\t\tUnavailable\n");
 printf("9\t\t2.9\t\t\t\t\tAvailable\n");
 printf("10\t\t2.10\t\t\t\t\tUnavailable\n");
 printf("\n\nPlease enter the number which room is available:");
 scanf("%d",&room);

switch(room)
{
case 1:printf("\nIt is available");return x=2.1;
case 2:printf("\nIt is available");return x=2.2;
case 3:printf("\nIt is available");return x=2.3;
case 4:printf("\nIt is sorry Miss/Mr. The room is unavailable. Please re-choose.\n");reserve();
case 5:printf("\nIt is available");return x=2.5;
case 6:printf("\nIt is available");return x=2.6;
case 7:printf("\nsorry Miss/Mr. The room is unavailable. Please re-choose.\n");reserve();
case 8:printf("\nsorry Miss/Mr. The room is unavailable. Please re-choose.\n");reserve();
case 9:printf("\nIt is available");return x=2.9;
case 10:printf("\nsorry Miss/Mr. The room is unavailable. Please re-choose.");reserve() ;
}
}
void bill()
{
system("cls");
system("color 75");
printf("Hi Mr/Miss, Please make your reservation first.\n\n\n");
option();
}

void end()
{
system("cls");
printf("Thank you for using our services. Have a nice day!\n");
}



//codingnibanyakflawssocorrectthemascreativeasyoucan
#justsharing

No comments: