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

Finalds Micro

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)
11 views15 pages

Finalds Micro

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
You are on page 1/ 15

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

Sr.no 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:
Sr.no. 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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy