Anda di halaman 1dari 11

CAB BOOKING SYSTEM

The objective of this project is to automate vehicle rental and reservation so that customer do not need
to call and spend unnecessary time in order to reserve a ride.

They can go in the application and reserve any kind of vehicle they want that is available. Even when a
customer chooses to visit the booking center to personally hire a vehicle, computers are available for
him to go online and perform his reservation. When he/she choose to reserve by computer the system
will provide all the services.

The Proposed update feature is to allow the passengers to track current status of the journey i.e we can
see the journey details in the application itself. The application also evaluates the amount each cab is
earning, and also it will figure out drop time of the journey between points like A or B, etc.

In Update system, we will implement the alarm system and sending notification to all family members in
case of any emergencies while make journey. For example, in case of accident the system will notify all
closed members of the person who reserved the cab.

Below are code snippets and the output consoles :

#include<stdio.h>

#include<conio.h>

#include<string.h>

#include<math.h>

#include<stdlib.h>

int distance(char *a,char *b);

void taxiprint(int);

int booking_id=1;
int taxi1,taxi2,taxi3,taxi4;

int taxi1_book,taxi2_book,taxi3_book,taxi4_book;

int taxi_earning[4];

struct taxi

int customer_id;

char pickup_point[10];

char drop_point[10];

int pickup_time;

}t[100];

struct booking

// static int taxi_earning[4];

int booking_id;

int customer_id;

char from[10];

char to[10];

int pickuptime;

int droptime;

int amount;

}b[4][100];
void booking(struct booking *b,struct taxi t,int no)

b->customer_id=t.customer_id;

b->booking_id=booking_id++;

strcpy(b->from,t.pickup_point);

strcpy(b->to,t.drop_point);

b->pickuptime=t.pickup_time;

b->droptime =distance(t.pickup_point,t.drop_point)+t.pickup_time;

if(b->droptime>12)

b->droptime-=12;

b->amount=100+((distance(t.pickup_point,t.drop_point)) * 6); //6 RS per kilometer and 100


for every service used

taxi_earning[no]+=b->amount;

int distance(char *a,char *b)

char start=a[0];

char stop=b[0];

return (abs(start-stop));

void decrement()

if(taxi1>0)
taxi1--;

if(taxi2>0)

taxi2--;

if(taxi3>0)

taxi3--;

if(taxi4>0)

taxi4--;

void taxiprint(int taxino)

printf("\n\t\t\t\tTaxi can be Allocated\n");

printf("\n\t\t\t\tTaxi- %d is allocated\n\n",taxino);

void display()

int i;

// printf("%d %d %d %d",taxi1_book,taxi2_book,taxi3_book,taxi4_book);

if(taxi1_book>0)

printf("\nTaxi 1 \nTotal Earning= %d\n",taxi_earning[0]);

printf("\nId\tCust_Id\tFrom\tTo\tPickup_time\tDrop_time\tAmount\n");

for(i=0;i<taxi1_book;i++)

printf("%d\t%d\t%s\t%s\t%d\t\t%d\t\t%d\n",b[0][i].booking_id,b[0][i].customer_id,b[0][i].from,b[0][i].t
o,b[0][i].pickuptime,b[0][i].droptime,b[0][i].amount);
}

if(taxi2_book>0)

printf("\nTaxi 2 \nTotal Earning= %d\n",taxi_earning[1]);

printf("\nId\tCust_Id\tFrom\tTo\tPickup_time\tDrop_time\tAmount\n");

for(i=0;i<taxi2_book;i++)

printf("%d\t%d\t%s\t%s\t%d\t\t%d\t\t%d\n",b[1][i].booking_id,b[1][i].customer_id,b[1][i].from,b[1][i].t
o,b[1][i].pickuptime,b[1][i].droptime,b[1][i].amount);

}if(taxi3_book>0)

printf("\nTaxi 3 \nTotal Earning= %d\n",taxi_earning[2]);

printf("\nId\tCust_Id\tFrom\tTo\tPickup_time\tDrop_time\tAmount\n");

for(i=0;i<taxi3_book;i++)

printf("%d\t%d\t%s\t%s\t%d\t\t%d\t\t%d\n",b[2][i].booking_id,b[2][i].customer_id,b[2][i].from,b[2][i].t
o,b[2][i].pickuptime,b[2][i].droptime,b[2][i].amount);

}if(taxi4_book>0)

printf("\nTaxi 4 \nTotal Earning= %d\n",taxi_earning[3]);

printf("\nId\tCust_Id\tFrom\tTo\tPickup_time\tDrop_time\tAmount\n");

for(i=0;i<taxi4_book;i++)
{

printf("%d\t%d\t%s\t%s\t%d\t\t%d\t\t%d\n",b[3][i].booking_id,b[3][i].customer_id,b[3][i].from,b[3][i].t
o,b[3][i].pickuptime,b[3][i].droptime,b[3][i].amount);

int main()

char user[10], pass[10];

Login:

printf("\n\n\n\t\t\t\tEnter Username : ");

scanf("%s", user);

printf("\n\n\n\t\t\t\tEnter Password : ");

scanf("%s", pass);

if(strcmp(user, "user") == 0 && strcmp(pass, "pass") == 0)

system("CLS");

while(1)

int user_choice,count,i;

printf("\n\t\t........................... Cab Booking System ...............................\n\n\n\n\n");

printf("\n\t\t\t\t1.Start Booking \n\n\t\t\t\t2.See Details \n\n\t\t\t\t3.Exit \n\n");

printf("\t\t\t\tEnter Choice:");

scanf("%d",&user_choice);
if(user_choice==1)

printf("\n\t\t\t\tNumber of Booking :");

scanf("%d",&count);

for(i=0;i<count;i++)

printf("\n\t\t\t\tInput %d:\n",i+1);

printf("\n\t\t\t\tCustomer Id :");

scanf("%d",&t[i].customer_id);

printf("\n\t\t\t\tPickup point (A/B/C/D/E):");

scanf("%s",t[i].pickup_point);

printf("\n\t\t\t\tDrop point (A/B/C/D/E):");

scanf("%s",t[i].drop_point);

printf("\n\t\t\t\tPickup time :");

scanf("%d",&t[i].pickup_time);

if(taxi1==0)

booking(&b[0][taxi1_book++],t[i],0);

taxi1=distance(t[i].pickup_point,t[i].drop_point);

taxiprint(1);

else if(taxi2==0)

booking(&b[1][taxi2_book++],t[i],1);

taxi2=distance(t[i].pickup_point,t[i].drop_point);
taxiprint(2);

else if(taxi3==0)

booking(&b[2][taxi3_book++],t[i],2);

taxi3=distance(t[i].pickup_point,t[i].drop_point);

taxiprint(3);

else if(taxi4==0)

booking(&b[3][taxi4_book++],t[i],3);

taxi4=distance(t[i].pickup_point,t[i].drop_point);

taxiprint(4);

else

printf("\n\t\t\t\tAll Taxi Are Busy.. Please Try after Some time");

decrement();

else if(user_choice==2)

display();

}
else

return 0;

else

printf("\n\n\n\t\t\t\tWrong Credentials :( ");

goto Login;

}
The above all screenshots of the output console.

---------------------------------------------------------------- Thank You --------------------------------------------------------

Anda mungkin juga menyukai