In: Computer Science
please write the code in C format avoid using (<<count>>)
Assume that you work for a travel agency. Write a C program that
performs 7 different tasks described below
for this company. The flights have the following
daily departure and arrival times:
| hotel name | cost | ride cost | |
| Rose | 248$ | 0$ | |
| Poprock | 90$ | 25$ | |
| flower | 128$ | 20$ | 
| departure time | arrival time | cost | 
| 7:15 am | 8:25am | 231$ | 
| 8:15 am | 9:25am | 226$ | 
| 9:15am | 10:25am | 226$ | 
| 10:15am | 11:25am | 283$ | 
| 11:15am | 12:25pm | 283$ | 
| 3:15pm | 4:25pm | 226$ | 
| 4:15pm | 5:25pm | 226$ | 
| 5:15pm | 6:25pm | 401$ | 
a) Based on the time entered by the customer, the closest departure time is displayed using 12- hour format.
b)the customer is asked if they would like a hotel and for how many days. hotel cost is mentioned above. Calculate the total cost (before taxes) and display it (flight + hotel for n number of days +ride).
c) now there is 2 types of discount:
Discount1: If the total fee is a multiple of 11,
then the
customer gets a 6% discount.
Discount2: An additional discount of 7% is given
to those customers whose subtotal
after discount1 is a multiple of the sum of digits of the
customer’s day of birth.
Three examples are given below for your convenience. See Sample
Input / output
for more clarification.
• Ex1: If the day of birth entered is 3, the customer will get an
additional 7%
discount if the sub-total of their purchase after discount1 is a
multiple of 3.
• Ex 2: If the day of birth entered is 12, the customer will get an
additional 7%
discount if their purchase after discount1 is a multiple of 3
(since sum of digits of
day of birth (12) is 3).
c)13% tax is applied to the total cost and the final bill is?
Solution:
The below is the required Code in C.
#include<stdio.h>
#include<math.h>
int main ()
{
    int dept1,dept2,dept3,dept4,dept5,dept6,dept7,dept8,hh,mm,usertime;
//Declare an array of integer of size
    int departure[8];
    int noOfDays,index;
    char m1[80]="Closet Departure time is 07:15 A.M,arriving at 08:25 A.M";
    char m2[80]="Closet Departure time is 08:15 A.M,arriving at 09:25 A.M";
    char m3[80]="Closet Departure time is 09:15 A.M,arriving at 10:25 P.M";
    char m4[80]="Closet Departure time is 10:15 A.M,arriving at 11:25 P.M";
    char m5[80]="Closet Departure time is 11:15 A.M,arriving at 12:25 P.M";
    char m6[80]="Closet Departure time is 03:15 P.M,arriving at 04:25 P.M";
    char m7[80]="Closet Departure time is 04:15 P.M,arriving at 05:25 P.M";
    char m8[80]="Closet Departure time is 05:15 P.M,arriving at 06:25 P.M";
//Calculate time in minutes and set to array positions
//indexes
    dept1=7*60+15;
    departure[0]=dept1;
    dept2=8*60+415;
    departure[1]=dept2;
    dept3=9*60+15;
    departure[2]=dept3;
    dept4=10*60+15;
    departure[3]=dept4;
    dept5=11*60+15;
    departure[4]=dept5;
    dept6=15*60+15;
    departure[5]=dept6;
    dept7=16*60+15;
    departure[6]=dept7;
    dept8=17*60+15;
    departure[7]=dept8;
        printf("Enter a time in any format:");
//prompt for time in hh and mm
        scanf("%d:%d",&hh,&mm);
//calculate time in minutes
        usertime=hh*60+mm;
        int closeDepartureIndex=0;
        int closeDeparture=usertime-departure[0];
//find the closest time
        for(index=1; index<8; index++)
        {
            if(abs((usertime-departure[index]))<closeDeparture)
            {
                closeDeparture= usertime-departure[index];
                closeDepartureIndex=index;
            }
        }
//pring message of corresponding index
        if(closeDepartureIndex==0)
            printf("%s",m1);
        else if(closeDepartureIndex==1)
            printf("%s",m2);
        else if(closeDepartureIndex==2)
            printf("%s",m3);
        else if(closeDepartureIndex==3)
            printf("%s",m4);
        else if(closeDepartureIndex==4)
            printf("%s",m5);
        else if(closeDepartureIndex==5)
            printf("%s",m6);
        else if(closeDepartureIndex==6)
            printf("%s",m7);
        else if(closeDepartureIndex==7)
            printf("%s",m8);
        printf("\nFor How many Days you would like to stay in hotel: ");
        scanf ("%d",&noOfDays);
        printf ("Enter the hotel name Rose/Poprock/Flower: \n");
        char hotelname[10];
        int cost;
        scanf("%s",&hotelname);
        char hotel1[10]="Rose";
        char hotel2[10]="Poprock";
        char hotel3[10]="Flower";
        if(hotelname==hotel1)
        {
            cost=noOfDays*248;
            printf("The cost is %d",cost);
        }
        else if(hotelname==hotel2)
        {
            cost=noOfDays*90;
            printf("The cost is %d",cost);
        }
        else
        {
            cost=noOfDays*128;
            printf("The cost is %d",cost);
        }
        int dayofbirth;
        printf("\nEnter the day of birth\n");
        scanf("%d",&dayofbirth);
        if(dayofbirth==3&&cost%3==0)
        {
            cost-=cost*0.07;
        }
        else if(dayofbirth==12&&cost%7==0)
        {
            cost-=cost*0.12;
        }
//13% tax is applied to the total cost and the final bill i
    printf("The final bill is %d\n",cost+cost*0.13);
    return 0;
}
The following is the Ouput snapshot:
Enter a time in any format:15:25
Closet Departure time is 03:15 P.M,arriving at 04:25 P.M
For How many Days you would like to stay in hotel: 10
Enter the hotel name Rose/Poprock/Flower:
Rose
The cost is 1280
Enter the day of birth
3
The final bill is 73896.
