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

Movie Ticket Booking System Report

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

Movie Ticket Booking System Report

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

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)
[Link] 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:
[Link] movies, "RRR" and "KGF," are available for booking.
[Link] show timings for each movie: 12:00 PM, 3:00 PM, and 6:00 PM.
[Link] availability is displayed, allowing users to select and book seats.
[Link] options include Card, UPI, and Netbanking.
[Link] 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].[Link][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].[Link][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

Common questions

Powered by AI

Implementing user authentication would personalize the user experience, allowing functionalities such as saving booking history, personal preferences, and faster checkouts on repeat visits. It would also enhance security by ensuring only authorized users can access or modify personal booking data .

The main function serves as the entry point, initializing movie details and shows, displaying menu options to users, and directing them to either view shows, book tickets, or exit. It interacts with other components like 'displayShows' and 'bookTickets' functions, facilitating sequence flow and user interactions .

The design minimizes seat selection errors by providing visual feedback of seat availability (‘O’ for empty, ‘X’ for occupied) and validating user inputs for row and column range before updating seat states. Invalid selections prompt error messages guiding users to correct choice, effectively reducing input errors .

Using a static 2D array for seat management is straightforward and efficient for a fixed seating plan. However, dynamic data structures could offer more flexibility, such as dynamic resizing for different theater capacities or seat arrangements, potentially reducing memory usage when dealing with varying theater sizes and configurations .

The system encourages modularity by dividing functionalities into separate functions, such as 'initializeShows,' 'displaySeats,' and 'bookTickets,' each handling specific tasks. This approach promotes code reuse, easier debugging, and enhances maintainability by allowing updates or changes in one module without affecting others .

The payment mechanism is effective in providing users with multiple options (Card, UPI, Netbanking) and confirms successful transactions through printed messages. However, improvements could include enhanced security measures, better error handling for transaction failures, and the addition of more payment gateways to widen user choices and increase system robustness .

The system is currently limited to two movies with three show timings each, which restricts its scalability as it can only handle predefined content and schedules. Future improvements propose extending the system to support additional movies, shows, and payment gateways, allowing for more dynamic content management .

The key functional steps include viewing available movies and shows, selecting seats, choosing payment options, and receiving booking confirmation. Users can choose from two movies, 'RRR' and 'KGF,' with three show timings. The system displays seat availability, allowing users to select seats, which enhances the user experience by providing transparency and control. Multiple payment options (Card, UPI, Netbanking) offer flexibility, and confirmation of bookings provides reassurance .

The Movie Ticket Booking System uses Maps to store show information for each movie, effectively managing multiple shows by assigning them to keys, facilitating easy lookup and display of show timings . The 2D arrays represent seat availability within theaters, where each element of the array corresponds to a seat, and its boolean value indicates if the seat is occupied, helping manage reservations efficiently .

The system currently displays messages for invalid seat selections or seat unavailability during booking, contributing to basic error handling . The report suggests enhancing error handling by improving input validation and potentially incorporating more sophisticated error recovery mechanisms, which would make the system more robust and user-friendly .

You might also like