Finalds Micro
Finalds Micro
CERTIFICATE
Ride sharing System (like Uber and Ola). is a bonafide work carried out by
Of class second year in partial fulfilment of the requirement for the completion of
course DS (CM31202) - EVEN2024 of Diploma in computer engineering from
Government Polytechnic Pune. The report has been approved as it satisfies the
academic requirements in respect of case study work prescribed for the course.
1|P age
GOVERNMENT POLYTECHINC PUNE
( All Autonomous Institute of Government of Maharashtra )
A MICROPROJECT REPORT ON
“Ride sharing System (like Uber and Ola).”
SUBMITTED BY:
Sr.no. Name of Student Enrollment no.
1 Varun Ballal 2306012
2 Darshan Choudhary 2306031
3 Dayanand Surwase 2306035
4 Sarthak Dhapare 2306039
2|P age
INDEX
SR TITLE PAGE
NO. NO.
1 Acknowledgement 4
2 Rationale 4
3 Course Outcome 4
4 Title 5
5 Introduction 5
6 Objective 5
8 Methodology 6
11 Conclusion 15
12 References 15
3|P age
Acknowledgement:-
I would like to express my sincere gratitude to my instructor and peers for
their guidance and support throughout this project. Their insights and
feedback helped me improve my understanding of C programming and data
structures.
Rationale:-
The rationale behind choosing this project is to learn how linked lists can be
implemented in a practical scenario. By simulating a real-world ride booking
system, the project provides hands-on experience with dynamic memory
allocation, traversal, insertion, and deletion operations in linked lists.
Course Outcome:-
4|P age
Title: Ride sharing System (like Uber and Ola)
Introduction:-
This project demonstrates a console-based ride booking system implemented in C
using linked lists. It allows users to set wallet balance, input a destination, find a
matching ride, and complete their ride, simulating real-life ride-hailing
applications such as Uber or Ola.
Objective:-
To implement a dynamic ride booking system using the concept of linked lists in
C language and apply data structure principles to manage ride entries efficiently.
5|P age
Methodology:-
1. Define data structures using structs: ride and passenger.
2. Implement a singly linked list to manage ride data.
3. Provide menu-driven interaction with options:
o Set balance
o Enter destination
o Book ride
o Complete ride
o Display available rides
4. Manage ride allocation and memory cleanup.
Implementation Details:-
• struct ride: Contains ride details and pointer to the next ride.
• struct passenger: Stores user details and pointer to their assigned ride.
Key Functions:
• add_available_ride(): Adds a new ride to the end of the linked list.
• display_rides(): Traverses and displays available rides.
• assign_ride_to_user(): Finds a ride by destination and removes it from the
list.
Actual Code:-
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
6|P age
struct ride
{
int rideID;
int rideAmount;
char rideDriver[15];
char rideDestination[25];
struct passenger *currentPassenger;
struct ride *nextRide;
};
struct passenger
{
int ID;
char name[15];
int amountBalance;
char destination[30];
struct ride *currentRide;
};
void display_rides()
{
struct ride *ptr;
ptr = RideStart;
if (ptr == NULL)
{
printf("No rides available \n");
return;
}
else
{
printf("Available Rides are : \n");
}
while (ptr != NULL)
{
printf("ride id = %d\n", ptr->rideID);
printf("ride Driver = %s\n", ptr->rideDriver);
printf("ride Amount = %d\n", ptr->rideAmount);
printf(" ride destination = %s\n", ptr->rideDestination);
ptr = ptr->nextRide;
}
}
return NULL;
}
int main()
{
// printf("hello");
// printf("%d",strcmp("nigdi","nigdi"));
// display_rides();
int choice;
struct ride *assigned_ride;
struct passenger *user = (struct passenger *)malloc(sizeof(struct passenger));
user->currentRide = NULL;
strcpy(user->destination, "");
strcpy(user->name, "");
switch (choice)
{
case 1:
printf("\nWallet balance : ");
int balance;
scanf("%d", &balance);
user->amountBalance = balance;
break;
case 2:
printf("\nDestination : ");
char destination[30];
scanf("%s", &destination);
strcpy(user->destination, destination);
break;
case 3:
printf("Finding ride...\n");
if (strcmp(user->destination, "") != 0)
{
assigned_ride = assign_ride_to_user(user->destination);
if (assigned_ride != NULL)
{
p r i n t f ( " \ n ⬛Assigned ride to your destination: %s\n", assigned_ride-
>rideDestination);
printf("Ride Details:\n");
printf("Captain : %s\n", assigned_ride->rideDriver);
printf("Ride Amount : %d\n", assigned_ride->rideAmount);
user->currentRide = assigned_ride;
}
else
{
printf("No rides found for destination: %s\n", user->destination);
}
}
else
{
printf("Please enter a destination first.\n");
}
break;
10 | P a g e
case 4:
if (user->currentRide == NULL)
{
printf("You haven't started any ride yet.\n");
}
else
{
struct ride *completedRide = user->currentRide;
free(completedRide);
user->currentRide = NULL;
strcpy(user->destination, "");
}
break;
case 5:
display_rides();
break;
default:
break;
}
} while (choice != 0);
return 0;
}
11 | P a g e
Results & Output:-
When the program is run, the user can interact with the system through a series of
menu options:
• Setting balance and destination.
• Getting a matching ride based on destination.
• Completing the ride and deducting fare.
• Displaying currently available rides.
12 | P a g e
13 | P a g e
14 | P a g e
Conclusion:-
Reference:-
• C Programming Language by Dennis Ritchie
• GeeksforGeeks: Data Structures in C
• TutorialsPoint: Linked List in C
15 | P a g e