100% found this document useful (1 vote)
108 views16 pages

Turf Management System 1

A complete java project as a turf management system.

Uploaded by

rahulajgaonkar9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
108 views16 pages

Turf Management System 1

A complete java project as a turf management system.

Uploaded by

rahulajgaonkar9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

TURF MANAGEMENT

SYSTEM

Created By :
Rahul Ajgaonkar (BITS-ID : 2023MS15040)
Darren Talati (BITS-ID : 2023MS15042)
(Group-25)

CONTENTS

Title Page Number


Problem Statement 2
Key Stakeholders 3
Key Operations 4
Source Code 5
Screenshots 12

1|Page
Problem Statement

We have observed quite a high number of turfs around me. So


many of them are not living up to their full potential from a
business perspective due to mismanagement. With this project,
we aim to solve that problem for them. This will definitely help
them solve their management issues and enable them to
generate revenue to their fullest potential.

We aim at developing a command line based turf management


system in C that allows users to carry out various operations as
mentioned further in this project. The system provides a user-
friendly interface for customers to interact with and manage
their respective bookings. Users are able to search and edit
bookings based on turf number and other similar fields. The
system incorporates user authentication and ensures secure
access to the functionalities.

2|Page
Key Stakeholders
Key Stakeholders could include :

Customers/Users : Users are people who want to book turf slots for
their games or sessions. They are the primary users of this system
and together they make the vast majority of our key stakeholders.

Admins/Managers : Admins are responsible for ensuring the proper


functioning of the organisation. They make sure everything is smooth
and running properly in the system.

Maintenance Staff : They are responsible for maintaining and keeping


the system running. They oversee technicalities.

Owners/Investors : These are the people who have vested money


and are bidding on the success of this project,

Regulatory authorities : These authorities are parts of the


government that oversee the legalities and make sure that the
system is audited regularly.

3|Page
Key Operations
Key operations include :
1)Authentication : Users can log in from this screen using their IDs
and Passwords.
2)Enter details : Users can enter their details. Details include Name,
Phone number, Address, Email, etc.
3)View booking : Users can view bookings to their name.
4)Delete Booking : Users can delete their existing booking(s).
5)Edit Booking : Users can edit the bookings they’ve made.

4|Page
Source Code

//use username and password as 'admin'


#include<stdio.h>
#include<time.h>
#include<ctype.h>
#include<conio.h>
#include<windows.h>
#include<stdlib.h>

// Function prototypes
void view1();
void update1();
void delete1();
void lookup1();
void add();
void loginProcess();

// Structure to hold booking details


struct bookingDetails {
char turfnumber[10];
char name[20];
char address[25];
char phonenumber[15];
char noOfPeople[15];
char email[20];
char noOfHours[10];
char bDate[10];
} s;

// Main function
int main() {
int i=0;
time_t t;
time(&t);
char bookingName;
char choice;
system("cls");
printf("\nCurrent date and time : %s",ctime(&t));
system("cls");
loginProcess(); // Call login function

5|Page
system("cls");
while (1) { // Infinite loop for the menu
system("cls");
printf("Use Numbers to Navigate the menu");
printf("\n\n");
printf(" \n1 -> Book Turf");
printf(" \n2 -> View Bookings");
printf(" \n3 -> Delete Booking");
printf(" \n4 -> Search Bookings");
printf(" \n5 -> Edit Booking");
printf(" \n6 -> Exit");
printf("\n");
printf("\n%s",ctime(&t)); // Display current time
choice=getche();
choice=toupper(choice);
switch(choice) { // Switch statement for menu options
case '1':
add(); // Call add function to book a turf
break;
case '2':
view1(); // Call view function to view bookings
break;
case '3':
delete1(); // Call delete function to delete a booking
break;
case '4':
lookup1(); // Call lookup function to search bookings
break;
case '5':
update1(); // Call update function to edit a booking
break;
case '6':
system("cls");
exit(0); // Exit the program
break;
default:
system("cls");
printf("Incorrect Input");
printf("\n Press any key to continue");
getch();
}
}
}

// Function to add a booking


void add() {
FILE *f;
char test;

6|Page
f=fopen("add.txt","a+"); // Open file in append mode
if(f==0) {
f=fopen("add.txt","w+"); // If file doesn't exist, create a new
one
system("cls");
printf("\nAny key to continue");
getch();
}
while(1) {
system("cls");
printf("\n Enter Booking Details:");
printf("\n----------------------------");
printf("\n Enter Turf number:\n");
scanf("\n%s",s.turfnumber);
fflush(stdin);
printf("Enter Name:\n");
scanf("%s",s.name);
printf("Enter Address:\n");
scanf("%s",s.address);
printf("Enter Phone Number:\n");
scanf("%s",s.phonenumber);
printf("Enter number of people:\n");
scanf("%s",s.noOfPeople);
printf("Enter Email:\n");
scanf(" %s",s.email);
printf("Enter number of hours:\n");
scanf("%s",&s.noOfHours);
printf("Enter Booking Date(dd\\mm\\yyyy):\n");
scanf("%s",&s.bDate);
fwrite(&s,sizeof(s),1,f); // Write the booking details to file
fflush(stdin);
printf("\n\nTurf booked");
printf("\nEsc to exit, any key to add another booking");
test=getche();
if(test==27)
break;
}
fclose(f);
}

// Function to view all bookings


void view1() {
FILE *f;
int i;
if((f=fopen("add.txt","r"))==NULL)
exit(0);
system("cls");
printf("TURF NO. ");

7|Page
printf("NAME\t ");
printf("\tADDRESS ");
printf("\tPHONE ");
printf("\t\tPEOPLE ");
printf("\t EMAIL ");
printf("\t\t \t HOURS ");
printf("\t \tDATE \n");
for(i=0;i<135;i++)
printf("-");
while(fread(&s,sizeof(s),1,f)==1) {
printf("\n%s \t %s \t\t%s \t%s \t%s \t %s \t \t%s \t
\t%s", s.turfnumber, s.name , s.address , s.phonenumber ,
s.noOfPeople , s.email, s.noOfHours, s.bDate);
}
printf("\n");
for(i=0;i<135;i++)
printf("-");
fclose(f);
getch();
}

// Function to delete a booking


void delete1() {
FILE *f,*t;
int i=1;
char turfnumber[20];
if((t=fopen("temp.txt","w"))==NULL)
exit(0);
if((f=fopen("add.txt","r"))==NULL)
exit(0);
system("cls");
printf("Enter a turf number to delete all bookings\n");
fflush(stdin);
scanf("%s", turfnumber);
while(fread(&s,sizeof(s),1,f)==1) {
if(strcmp(s.turfnumber, turfnumber) == 0) {
i=0;
continue;
} else
fwrite(&s,sizeof(s),1,t);
}
if(i==1) {
printf("\n\n No bookings for this turf found");
getch();
fclose(f);
fclose(t);
main();
}

8|Page
fclose(f);
fclose(t);
remove("add.txt");
rename("temp.txt","add.txt");
printf("\n\nAll bookings are removed");
fclose(f);
fclose(t);
getch();
}

// Function to search for a booking


void lookup1() {
system("cls");
FILE *f;
char turfnumber[20];
int flag=1;
f=fopen("add.txt","r+");
if(f==0)
exit(0);
fflush(stdin);
printf("Enter a turf number to view latest booking \n");
scanf("%s", turfnumber);
while(fread(&s,sizeof(s),1,f)==1) {
if(strcmp(s.turfnumber, turfnumber) == 0){
flag=0;
printf("\nTurf Number:\t%s",s.turfnumber);
printf("\nName:\t%s",s.name);
printf("\nAddress:\t%s",s.address);
printf("\nPhone:\t%s",s.phonenumber);
printf("\nPeople:\t%s",s.noOfPeople);
printf("\nEmail:\t%s",s.email);
printf("\nHours:\t%s",s.noOfHours);
printf("\nDate:\t%s",s.bDate);
flag=0;
break;
}
}
if(flag==1) {
printf("\n\tNo bookings for this turf number");
}
getch();
fclose(f);
}

// Function to update a booking


void update1() {
FILE *f;
int k=1;

9|Page
char turfnumber[20];
long int size=sizeof(s);
if((f=fopen("add.txt","r+"))==NULL)
exit(0);
system("cls");
printf("Enter Turf number:\n\n");
scanf("%[^\n]", turfnumber);
fflush(stdin);
while(fread(&s,sizeof(s),1,f)==1) {
if(strcmp(s.turfnumber, turfnumber) == 0) {
k=0;
printf("\nEnter Turf Number :");
gets(s.turfnumber);
printf("\nEnter Name :");
fflush(stdin);
scanf("%s",&s.name);
printf("\nEnter Address :");
scanf("%s",&s.address);
printf("\nEnter Phone number :");
scanf("%f",&s.phonenumber);
printf("\nEnter No of People :");
scanf("%s",&s.noOfPeople);
printf("\nEnter Email :");
scanf("%s",&s.email);
printf("\nEnter hours :");
scanf("%s",&s.noOfHours);
printf("\nEnter Date :");
scanf("%s",&s.bDate);
fseek(f,size,SEEK_CUR); //to go to desired position infile
fwrite(&s,sizeof(s),1,f);
break;
}
}
if(k==1) {
printf("\n\nNo Booking");
fclose(f);
getch();
} else {
fclose(f);
printf("\n\n\t\tBooking updated");
getch();
}
}

// Function for user login


void loginProcess() {
int a=0,i=0;
char uname[10],c=' ';

10 | P a g e
char pword[10],code[10];
char user[10]="admin";
char pass[10]="admin";
do {
system("cls");
printf(" \nUsername: ");
scanf("%s", &uname);
printf("Password: ");
while(i<10) {
pword[i]=getch();
c=pword[i];
if(c==13) break;
else printf("*");
i++;
}
pword[i]='\0';
i=0;
if(strcmp(uname,user)==0 && strcmp(pword,pass)==0) {
break;
} else {
printf("\n Login Unsuccessful");
a++;
getch();
}
} while(a<=2);
if (a>2) {
printf("\nYou have used all attempts");
getch();
}
system("cls");
}

11 | P a g e
Project Screenshots

Authentication Screen :

12 | P a g e
Navigation Menu :

Booking Details Entering Screen :

13 | P a g e
Bookings View :

Booking deletion Screen :

14 | P a g e
View Latest Booking Details :

15 | P a g e
Edit and Update Booking :

16 | P a g e

You might also like