0% found this document useful (0 votes)
12 views15 pages

Ride Sharing System Case Study Report

The document is a certificate and report for a case study project on a ride-sharing system implemented in C, carried out by a group of students at Government Polytechnic Pune. The project focuses on using linked lists to manage ride bookings and includes details on methodology, implementation, and results. It aims to enhance understanding of data structures and dynamic memory management in programming.

Uploaded by

manesayali0212
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)
12 views15 pages

Ride Sharing System Case Study Report

The document is a certificate and report for a case study project on a ride-sharing system implemented in C, carried out by a group of students at Government Polytechnic Pune. The project focuses on using linked lists to manage ride bookings and includes details on methodology, implementation, and results. It aims to enhance understanding of data structures and dynamic memory management in programming.

Uploaded by

manesayali0212
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

GOVERNMENT POLYTECHNIC PUNE

(An Autonomous Institute of Government of Maharashtra)

DEPARTMENT OF COMPUTER ENGINEERING

Academic Year 2024-25

CERTIFICATE

This is certified that the case study work entitled

Ride sharing System (like Uber and Ola). is a bonafide work carried out by

[Link] Group Members Enrolment no.


1 Varun Ballal 2306012
2 Darshan Choudhary 2306031
3 Dayanand Surwase 2306035
4 Sarthak Dhapare 2306039

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.

Smt V. S. Pawar J. R. Hange Dr. Rajendra K. Patil

(Guided by) (Head of department) (Principal)

1|P age
GOVERNMENT POLYTECHINC PUNE
( All Autonomous Institute of Government of Maharashtra )

A MICROPROJECT REPORT ON
“Ride sharing System (like Uber and Ola).”

FOR THE COURSE:


PYTHON PROGRAMMING ( CM41202)

SUBMITTED BY:
[Link]. Name of Student Enrollment no.
1 Varun Ballal 2306012
2 Darshan Choudhary 2306031
3 Dayanand Surwase 2306035
4 Sarthak Dhapare 2306039

UNDER THE GUIDENCE OF:


LECT. V. S. PAWAR MAM

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

7 Software & Tools Used 5

8 Methodology 6

9 Implementation Details 6-11

10 Results & Output 12-14

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:-

• Gained practical understanding of linked list data structures.


• Learned dynamic memory management using malloc and free.
• Understood struct-based data organization.
• Applied traversal, insertion, and deletion in a real-world use case.
• Enhanced debugging and logic-building skills in C.

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.

Software & Tools Used:-

• C Language (GCC Compiler)


• Console/Terminal
• Code Editor (e.g., Code::Blocks, VS Code)

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>

struct ride *RideStart = NULL;


struct passenger *CustStart = NULL;
int rideCount = 0;

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 add_available_ride(char dName[15], int amount, char destination[25])


{
struct ride *tmp = (struct ride *)malloc(sizeof(struct ride));
struct ride *ptr;
tmp->rideAmount = amount;
strcpy(tmp->rideDriver, dName);
strcpy(tmp->rideDestination, destination);
tmp->nextRide = NULL;
tmp->rideID = rideCount;
rideCount += 1;
if (RideStart == NULL)
{
RideStart = tmp;
}
else
{
ptr = RideStart;
while (ptr->nextRide != NULL)
{
ptr = ptr->nextRide;
}
7|P age
ptr->nextRide = tmp;
}
}

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;
}
}

struct ride *assign_ride_to_user(char destination[25])


{
struct ride *ptr = RideStart;
struct ride *preptr = NULL;

while (ptr != NULL)


{
if (strcmp(ptr->rideDestination, destination) == 0)
{
if (preptr == NULL)
{
RideStart = ptr->nextRide;
}
else
{
8|P age
preptr->nextRide = ptr->nextRide;
}
ptr->nextRide = NULL;
return ptr;
}
preptr = ptr;
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, "");

add_available_ride("darshan", 1500, "chinchwad");


add_available_ride("sarthak", 123, "nigdi");
add_available_ride("hemant", 204, "pune");
add_available_ride("Ayush", 123, "sangvi");
add_available_ride("Gaurav", 123, "aundh");
add_available_ride("Maruti", 123, "pimpri");
add_available_ride("Sai", 123, "shivajinagar");
// display_rides();
// assign_ride_to_user("nigdi");
// display_rides();
do
{
printf(" ---- USER OPTIONS ---- \n");
printf("1. Enter your wallet balance \n");
printf("2. Enter your destination \n");
printf("3. Find the ride \n");
printf("4. Complete your ride \n");
printf("5. Display available rides ");
9|P age
printf("\nChoice : ");
scanf("%d", &choice);

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;

printf("Completing ride to %s\n", completedRide->rideDestination);


printf("Ride Captain: %s\n", completedRide->rideDriver);
printf("Ride Fare: %d\n", completedRide->rideAmount);

if (user->amountBalance >= completedRide->rideAmount)


{
user->amountBalance -= completedRide->rideAmount;
printf("Ride completed successfully!\n");
printf("Remaining Balance: %d\n", user->amountBalance);
}
else
{
printf("Insufficient balance to pay for this ride!\n");
printf("Please recharge your wallet.\n");
}

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:-

This project effectively demonstrates the practical use of linked lists in C to


manage a dynamic set of records. It strengthens understanding of struct
manipulation, memory allocation, and traversal techniques in data structures.
Future enhancements can include support for multiple passengers, ride ratings, or
integration with file storage.

Reference:-
• C Programming Language by Dennis Ritchie
• GeeksforGeeks: Data Structures in C
• TutorialsPoint: Linked List in C

15 | P a g e

Common questions

Powered by AI

The potential future enhancements for the ride-sharing system include support for multiple passengers, ride ratings, and integration with file storage. Implementing these improvements could significantly enhance the user experience by allowing the system to cater to complex real-world scenarios, such as carpooling with multiple passengers and providing user feedback through ratings. Integration with file storage can also ensure data persistence, enabling users to have a more reliable interaction with the system by recovering their ride history, thus offering a more comprehensive ride-hailing solution .

Enhancing the ride-sharing system to support file storage for data persistence could present challenges such as ensuring data consistency and handling file I/O operations securely. Addressing these would involve implementing robust error handling to manage file read/write errors and ensuring proper synchronization between memory and file data. Additionally, adopting data serialization techniques can facilitate efficient storage and retrieval, while maintaining data integrity. These steps would address potential implementation difficulties and improve the system's robustness .

The user's interaction with the ride-sharing system is designed through a menu-driven interface, allowing them to perform actions such as setting a wallet balance, entering a destination, booking a ride, completing the ride, and displaying currently available rides. This structured approach ensures that users can manage different scenarios effectively, such as verifying their balance before booking or confirming their ride details before completion, thereby enhancing usability and user experience .

The primary challenges of using linked lists for dynamic memory management in the ride-sharing system include the complexity of ensuring efficient traversal and manipulation of nodes for insertion and deletion. Managing memory reallocation properly is crucial to avoid leaks or segmentation faults, requiring careful implementation of malloc and free operations. These complexities can lead to increased chances of bugs and require rigorous testing and debugging to ensure stability and proper memory management .

The implementation of the ride-sharing system using linked lists allows dynamic memory allocation and efficient management of ride entries through traversal, insertion, and deletion operations. This setup closely mirrors real-life applications by providing menu-driven interactions for users to set their balance, enter destinations, book rides, and complete rides. These features are essential for simulating a real-world ride-hailing experience, similar to Uber or Ola, by managing available rides dynamically and allocating rides based on user requests .

Struct-based data organization in the ride-sharing system allows the encapsulation of related attributes for rides and passengers, such as ride ID, amount, driver name, and destination. This grouping enhances the management of details by making data handling operations more efficient and structured, facilitating easier manipulation, such as adding, removing, or updating ride information within the linked list .

The system manages user wallet balance by allowing users to set their balance through a menu option and checking this balance before completing a ride. During ride completion, the system verifies if the user has sufficient balance to cover the ride cost. If the balance is adequate, the fare is deducted from their wallet. In case of insufficient funds, a warning is provided prompting the user to recharge, ensuring that financial transactions are handled securely and user errors are minimized .

The function assign_ride_to_user() plays a crucial role in the rider allocation process by traversing the linked list to match a ride based on the user's specified destination. It is implemented by iterating over rides and performing a string comparison with the desired destination. Once a match is found, it detaches this ride from the list and assigns it to the user, ensuring the efficient allocation of resources matching the user's request .

The rationale behind choosing linked lists for developing the ride booking system lies in their inherent advantages in scenarios requiring dynamic data changes, such as adding or removing rides. Linked lists allow for efficient insertion and deletion without needing to reorganize the entire data structure, unlike arrays. This makes them well-suited for dynamic applications like a ride-sharing system where entries frequently change, and operational flexibility is necessary .

The key functions in the ride-sharing system include add_available_ride(), display_rides(), and assign_ride_to_user(). These functions support ride allocation by first adding rides to a singly linked list, allowing traversal to display available rides, and enabling the allocation of rides to users based on their specified destination. The use of these functions ensures that rides can be dynamically managed and allocated efficiently for the users .

You might also like