0% found this document useful (0 votes)
5 views12 pages

DSIIProject Report Templete

Uploaded by

manojboppana5
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)
5 views12 pages

DSIIProject Report Templete

Uploaded by

manojboppana5
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/ 12

A Project report on

Movie Ticket Booking System

This project is part of DS II Lab evaluation

Course Name
In
Specialization

Submitted by

Jaswanth Rao Madala (AP22110010937)

Jaya krishna Chandra Mamillapalli (AP22110010938)


Rup Sai karthik Uday kumar(AP22110010957)
B.Venkat Manoj Kumar(AP22110010963)

SRM University–AP
Neerukonda, Mangalagiri, Guntur
Andhra Pradesh – 522 240
Nov, 2023
1. Introduction
The Movie Ticket Booking System is a C program designed to facilitate the booking
of movie tickets for different shows and movies. It provides an interactive interface
for users to view available shows, select movies, book tickets, and make payments.

2. Process
ALGORITHM:

Data Structures Used:


Map: A data structure used to store show information corresponding to each movie.
Structure (mov): Represents a movie, containing its title, show information (using
the Map), and a 2D array to track seat availability.

User Interaction:
Users can view available shows and select the desired movie and show.
Seat selection allows users to choose the number of tickets and specific seats.
Payment options provide flexibility with Card, UPI, and Netbanking.
Confirmation messages and a summary of the booked tickets are displayed.

STEPS:
1.Two movies, "RRR" and "KGF," are available for booking.
2.Three show timings for each movie: 12:00 PM, 3:00 PM, and 6:00 PM.
3.Seat availability is displayed, allowing users to select and book seats.
4.Payment options include Card, UPI, and Netbanking.
5.Users can view available shows, book tickets, and exit the system.

3. Code
#include <stdio.h>
#include <stdlib.h>

1
#include <stdbool.h>
#include <string.h>

// Structure to represent a key-value pair in the map


typedef struct {
int key;
char value[50];
} KeyValuePair;

// Map ADT
typedef struct {

KeyValuePair entries[6];

} Map;

typedef struct movie {


char title[50]; // Movie title
Map shows; // Use the map to store show information
bool seats[8][10];
} mov;

mov m[2]; // Use an array of 2 movies

// Function to initialize the map entries for shows


void initializeShows(Map *map, const char *show1, const char *show2, const char
*show3) {
map->entries[1].key = 1;
map->entries[2].key = 2;
map->entries[3].key = 3;

2
strcpy(map->entries[1].value, show1);
strcpy(map->entries[2].value, show2);
strcpy(map->entries[3].value, show3);
}

void initializeMovieSeats(mov *movie) {


for (int i = 0; i < 8; ++i) {

for (int j = 0; j < 10; ++j) {

movie->seats[i][j] = false;
}
}
}

void displayShows() {

printf("\nMovies:\n");

for (int i = 0; i < 2; ++i) {


printf("%d. %s\n", i + 1, m[i].title);
}

printf("\nShows:\n");
for (int i = 1; i <= 3; ++i) {
printf("%d) %s\n", i, m[0].shows.entries[i].value);
}
}

void displaySeats(int screen) {


printf("\nMovie: %s\n", m[screen].title);
printf("Available seats: \n");

3
printf(" ");
for (int j = 0; j < 10; ++j) {
printf("%d ", j + 1);
}
printf("\n");

for (int i = 0; i < 8; ++i) {


printf("%c ", 'A' + i);

for (int j = 0; j < 10; ++j) {

printf("%c ", m[screen].seats[i][j] ? 'X' : 'O');


}
printf("\n");
}

printf("O - empty \nX - occupied\n");

void bookTickets() {
printf("\nChoose movie:\n");
for (int i = 0; i < 2; ++i) {
printf("%d. %s\n", i + 1, m[i].title);
}

printf("Enter choice: ");


int movieChoice;
scanf("%d", &movieChoice);

mov *selectedMovie = &m[movieChoice - 1];

printf("\nShows:\n");

4
for (int i = 1; i <= 3; ++i) {
printf("%d) %s\n", i, m[0].shows.entries[i].value);
}

int showChoice;
printf("\nEnter show choice: ");
scanf("%d", &showChoice);

int screen = movieChoice - 1;

displaySeats(screen);

int numTickets;

printf("Enter number of tickets: ");

scanf("%d", &numTickets);

for (int i = 0; i < numTickets; ++i) {


char rowindex;
int col;

while (1) {
printf("Ticket %d: (row column): ", i + 1);
scanf(" %c %d", &rowindex, &col);

int row = (rowindex) - 64;

if (row < 1 || row > 8 || col < 1 || col > 10) {


printf("Invalid ticket selection. Please try again.\n");
} else if (selectedMovie->seats[row - 1][col - 1]) {

5
printf("Seat already occupied. Please try again.\n");
} else {
selectedMovie->seats[row - 1][col - 1] = true;
break;
}
}

printf("\n\n");
displaySeats(screen);
printf("Booked\n\n");
}

// Payment

int totalCost = numTickets * 150;

printf("Total cost: %d", totalCost);

enum PaymentOption {
CARD = 1,
UPI,
NETBANKING,
CANCEL
};

printf("\nSelect payment option:\n1) Card \n2) UPI \n3) Netbanking\n4)


Cancel\nEnter choice: ");
int payment;
scanf("%d", &payment);

6
switch (payment) {
case CARD:
printf("Payment successful via card\n");
break;
case UPI:
printf("Payment successful via UPI\n");
break;
case NETBANKING:
printf("Redirecting to netbanking\n");

printf("Payment successful via netbanking\n");

break;
case CANCEL:
printf("Payment canceled\n");

exit(0);

default:
printf("Invalid choice\n");
}

printf("\nTickets booked successfully for movie %s on screen %d",


selectedMovie->title, screen + 1);
printf("\nThank you, enjoy the movie\n");
}

int main() {
printf("\nWelcome to MovieTicket");

char movie1[] = "RRR";


char movie2[] = "KGF";

7
char show1[] = "12:00 PM";
char show2[] = "3:00 PM";
char show3[] = "6:00 PM";

// Initialize the shows for each movie

initializeShows(&m[0].shows, show1, show2, show3);


initializeShows(&m[1].shows, show1, show2, show3);

strcpy(m[0].title, movie1);

strcpy(m[1].title, movie2);

int choice;

while (1) {
printf("\n\n1. Display Available shows\n2. Book Tickets\n3. Exit\nEnter your
choice: ");
scanf("%d", &choice);

switch (choice) {
case 1:
displayShows();
break;
case 2:
bookTickets();
break;
case 3:
printf("\nHave a nice day\n");
exit(0);

8
default:
printf("Invalid choice\n");
}
}
return 0;
}

4. Results

9
10
5. Conclusion
Implement user authentication for a personalized experience.
Enhance error handling and input validation for robustness.
Extend the system to support additional movies, shows, and payment gateways.
Implement a database to store booking information for future reference.

11

You might also like