Coders Packet

Bus Ticket Reservation System using Java and MySQL

By Ayushi Vyas

In this article, we will learn how to build a bus ticket reservation system. This Bus ticket Reservation System will enable a private bus operator to book tickets.

Tech Stack

For this project, we are using the below tech stack:

- Java framework

- NetBeans IDE (Integrated Development Environment) - as it is very easy to make a GUI (graphical user interface) in NetBeans by dragging and positioning the GUI components. (Netbeans IDE 8.2)

- MySQL server to create databases and tables. (MySQL Workbench 8.0 CE)

- JDBC (Java database connectivity)

- MySQL-connector to connect the database with java.

Operations can be done

The main objective of this project is to convert manual ticket booking to an e-ticket booking system. This application can be used by any bus operator to book tickets.

This System consists of the Customer and its travel details such as Name, Contact number, Source/Destination, Seat No., date of Journey, and Ticket price.

A particular Seat Number can be allotted to only one customer for the particular date of a particular bus. The same seat for the same bus for the same date won’t be allocated.

When we book a ticket, a ticket appears on the screen and we can print it to deliver to customers.

Details of previous bookings can also be accessed.

Adding Libraries/Jar Files and jCalendar

Java Libraries

1. jCalendar.jar

2. MySql-connector-java-8.0.25.jar

3. swing-all-1.6.4.jar

Click on your project libraries and click on add Jar/Folder... -> select the files -> open.

For jCalendar click on tools-> Palatte-> Swing/AWT Components-> Add from Jar...->search jcalendar.jar in your system-> select the file -> open(you need to download it from internet).

jFrame for inserting customer and ticket details

jFrame for Check Previous Bookings

Follow the below steps to run the entire project

1. Enter customer name, contact number in text fields, select the Source and Destination stations from Combo-box, select the seat number by clicking      the numbers, select the date from the calendar and enter the price of the ticket in the text field.

2. Click on the "BOOK" button and the ticket appears in the given text box.

3. Clear button clears all the data entered before and the "Check Booking" button takes us to the next page.

4. Select the date from the calendar and click on the "Search" button which shows if any ticket is booked for this date or not.

5. If there are bookings on the selected date the data will appear in the table.

6. All the inserted data is stored in the MySQL database.



Download Complete Code


No comments yet

Download Packet

Reviews Report

Submitted by Ayushi Vyas (Ayushi0306)

Download packets of source code on Coders Packet