0% found this document useful (0 votes)
13 views

Java Report - Final

Uploaded by

nangarepradnya21
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Java Report - Final

Uploaded by

nangarepradnya21
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 24

Chapter 1 – Introduction

In today's fast-paced world, traveling by bus is a convenient and affordable mode of


transportation for many people. However, booking bus tickets can be a tedious and time-
consuming process, especially when done manually. With the advent of technology, online
bus reservation systems have emerged as a solution to simplify this process.

Bus Reservation and Ticketing System is a simple console based application in Java.
The feature of this simple application includes adding passengers record, billing and viewing
total records. In order to add a passenger, the user has to provide passenger’s name,
destination, number of passengers and discount number. Other features include viewing
available destination records, billings. This whole system is not built with the help of
Netbeans IDE.

There’s no external database connectivity in this simple project. For billings, he/she
has to enter passenger’s name. Then the system displays all the informations of the passenger
such as name, destination, fare price, number of passengers and discount amount. It also
shows the total fare amount and the user has to provide the amount to pay. To view records,
the user can simply provide passenger’s name which will display each and every information
including total fare price with paid amount, change and status.

*Project Overview*

The Online Bus Reservation System project aims to design and develop a user-
friendly and efficient web-based application that allows users to search for buses, reserve
seats, and pay for tickets online. The system will provide real-time bus schedule and seat
availability, ensuring a smooth and hassle-free booking experience.

1
*Problem Statement*

The existing manual bus reservation system has several limitations, including:

- Time-consuming and labor-intensive booking process

- Limited access to bus schedules and seat availability

- Inefficient payment processing

- Lack of user-friendly interface

- Inability to book tickets online

The Online Bus Reservation System project seeks to address these limitations by
providing a comprehensive and user-friendly online platform for bus ticket booking, thereby
enhancing the overall travel experience for customers.

2
Chapter 2 – Features

Here are the features of an Online Bus Reservation System project using Advanced Java Swing
in detail:

1. User Registration and Login

- Users can register with their name, email, password, and contact information
- Users can log in using their email and password
- Passwords are encrypted for secure storage

2. Bus Search and Schedule Display

- Users can search for buses by route, date, and time


- Search results display bus schedules, available seats, and fares
- Users can filter search results by bus type, departure time, and arrival time

3. Seat Reservation and Cancellation

- Users can reserve seats by selecting the bus and seat numbers
- Users can cancel reservations before the departure time
- Seat availability is updated in real-time

4. Payment Processing

- Users can pay for reservations using a secure payment gateway (e.g. PayPal, Stripe)
- Payment details are encrypted for secure transmission
- Payment confirmation is sent to the user’s email

5. Ticket Confirmation and Printing/Emailing

- Users receive a ticket confirmation with reservation details


- Users can print or email the ticket confirmation
- Ticket confirmations include a QR code for easy verification

6. Administrator Dashboard

- Administrators can manage bus schedules, routes, and reservations


- Administrators can add, edit, or delete bus information
- Administrators can view reservation reports and analytics

7. Email and SMS Notifications

- Users receive email notifications for reservation confirmations and cancellations


- Users receive SMS notifications for reservation confirmations and cancellations

8. Integration with Google Maps


3
- Bus routes are displayed on Google Maps
- Users can view bus stops and routes on Google Maps

9. User Reviews and Ratings

- Users can rate and review buses and services


- Ratings and reviews are displayed on the bus details page

10. Secure Payment Gateway

- Payment gateway is integrated using APIs (e.g. PayPal, Stripe)


- Payment details are encrypted for secure transmission

11. Database Management

- MySQL or Oracle Database is used for storing bus schedules, routes, and reservations
- JDBC (Java Database Connectivity) is used for interacting with the database

12. GUI Features

- Java Swing components are used for the graphical user interface (GUI)
- GUI features include buttons, labels, text fields, tables, and combo boxes

These features provide a comprehensive online bus reservation system with advanced Java
Swing and database management.

4
Chapter 3 – Objective

 The main purpose of this study is to automate the manual procedures of reserving a bus
ticket for any journey made through Imo Transport Company (ITC). This system is
said to be an automatic system and customers can select seats by themselves.
Specifically, objectives of this project will consist of:

i) Providing a web-based bus ticket reservation function where a customer can buy
bus ticket through the online system without a need to queue up at the counter to
purchase a bus ticket.

ii) Enabling customers to check the availabilitanima types of busses online.


Customer can check the time departure for every ITC bus through the
system.

iii) Easing bus ticket payment by obtaining a bank pin after payments is made to the
various designated banks.

iv) Ability of customers to cancel their reservation.

v) Admin user privileges in updating and canceling payment, route and vehicle
records

5
6
7
Chapter 4 – Components of the project

Here are the components of an Online Bus Reservation System project using Advanced Java Swing
in detail:

1. JFrame (Main Window)

- Title: “Online Bus Reservation System”


- Size: 800x600 pixels
- Layout: BorderLayout

2. JPanel (Header Panel)

- Background color: #007bff (blue)


- Components:
- JLabel (title): “Online Bus Reservation System”
- JButton (login): “Login”
- JButton (register): “Register”

3. JPanel (Search Panel)

- Background color: #f7f7f7 (gray)


- Components:
- JLabel (from): “From:”
- JComboBox (from): list of cities
- JLabel (to): “To:”
- JComboBox (to): list of cities
- JLabel (date): “Date:”
- JDateChooser (date): calendar
- JButton (search): “Search”

4. JTable (Bus Schedule Table)

- Column names: “Bus Number”, “Departure Time”, “Arrival Time”, “Fare”, “Available Seats”
- Row data: bus schedule information

8
5. JPanel (Reservation Panel)

- Background color: #f7f7f7 (gray)


- Components:
- JLabel (bus number): “Bus Number:”
- JComboBox (bus number): list of bus numbers
- JLabel (seat number): “Seat Number:”
- JComboBox (seat number): list of seat numbers
- JButton (reserve): “Reserve”
- JButton (cancel): “Cancel”

6. JPanel (Payment Panel)

- Background color: #f7f7f7 (gray)


- Components:
- JLabel (payment method): “Payment Method:”
- JComboBox (payment method): list of payment methods
- JTextField (card number): “Card Number:”
- JTextField (expiration date): “Expiration Date:”
- JTextField (cvv): “CVV:”
- JButton (pay): “Pay”

7. JLabel (Ticket Confirmation)

- Text: “Ticket Confirmation”


- Font size: 24

8. JTextArea (Ticket Details)

- Text: ticket details (bus number, seat number, departure time, arrival time, fare)

9. JButton (Print Ticket)

- Text: “Print Ticket”

10. JButton (Email Ticket)

9
- Text: “Email Ticket”

11. JDialog (Login Dialog)

- Title: “Loents:
- JLabel (email): “Email:”
- JTextField (email): email address
- JLabel (password): “Password:”
- JPasswordField (password): password
- JButton (login): “Login”

12. JDialog (Register Dialog)

- Title: “Register”
- Components:
- JLabel (name): “Name:”
- JTextField (name): name
- JLabel (email): “Email:”
- JTextField (email): email address
- JLabel (password): “Password:”
- JPasswordField (password): password
- JButton (register): “Register”

10
Chapter 5–Advantages and Disadvantages

Here are the advantages and disadvantages of an Online Bus Reservation System
project using Advanced Java Swing:

Advantages:

1. Convenience: Users can book bus tickets online from anywhere, at any time.

2. Easy to use: User-friendly interface makes it easy for users to navigate and book tickets.

3. Real-time availability: Users can check seat availability in real-time.

4. Secure payment: Secure payment gateway ensures safe transactions.

5. Reduced paperwork: Electronic tickets reduce paperwork and minimize errors.

6. Increased efficiency: Automates the booking process, reducing manual labor.

7. Better customer service: Provides a better customer experience through quick and easy
booking.

8. Scalability: Can handle a large number of users and bookings.

9. Cost-effective: Reduces operational costs by minimizing manual labor and paperwork.

10. Environmentally friendly: Reduces carbon footprint by minimizing paper usage.

Disadvantages:

1. Technical issues: Technical problems can occur, such as server downtime or payment
gateway issues.

2. Internet connectivity: Requires a stable internet connection, which can be a problem in


11
areas with poor connectivity.

3. Security risks: Online transactions can be vulnerable to cyber attacks and data breaches.

4. Dependence on technology: The system is dependent on technology, which can be a


problem if there are technical issues.

5. Limited accessibility: Not all users may have access to the internet or be comfortable
using online systems.

6. Maintenance: Requires regular maintenance to ensure smooth operation.

7. Upfront costs: Requires upfront costs for development, deployment, and maintenance.

8. Training: Users may require training to use the system effectively.

9. Support: Requires ongoing support to address user issues and technical problems.

10. Competition: May face competition from other online bus reservation systems.

By understanding these advantages and disadvantages, you can better plan and develop your
Online Bus Reservation System project using Advanced Java Swing.

12
Chapter 5 – Data Flow Diagram (DFD)

data flow diagram (DFD) is a graphical representation of the “flow” of data through an
information system, modeling its process aspects. A DFD shows what kind of information will be input
to and output from the system, where the data will come from and go to, and where the data will be
stored.
The development of DFD’S is done in several levels. Each process in lower level diagrams
can be broken down into a more detailed DFD in the next level. The Top-level diagram is often called
context diagram. It consist a single process bit, which plays vital role in studying the current system. The
process in the context level diagram is exploded into other process at the first level DFD. Figures to
shows a data flow diagram about the system. Level 0

13
14
Chapter 6 – Usecase Diagram

A use case is a description of a system’s behaviour as it responds to a


request that originates from outside of that system (the user). In figure 3.4, a use
case of the activities in a bus transport system is shown.
In other words a use case describes “who” can do “what” with the system in
question. The use case technique is used to capture a system’s behavioural
requirements by detailing scenario-driven threads through the functional
requirements.

15
Chapter 7- source code

Import javax.swing.*;
Import java.awt.*;
Import java.awt.event.*;
Import java.util.ArrayList;
Import java.util.HashMap;
Import java.util.Map;

// Bus class to represent bus details


Class Bus {
Int busNumber;
String destination;
Int totalSeats;
Int availableSeats;
Double ticketPrice;
String time;

Public Bus(int busNumber, String destination, int totalSeats, double


ticketPrice, String time) {
This.busNumber = busNumber;
This.destination = destination;
This.totalSeats = totalSeats;
This.availableSeats = totalSeats;
This.ticketPrice = ticketPrice;
This.time = time;
}

Public boolean reserveSeat() {


If (availableSeats > 0) {
availableSeats--;
return true;
} else {
Return false;
}
}

Public boolean cancelReservation() {


If (availableSeats < totalSeats) {
16
availableSeats++;
return true;
} else {
Return false;
}
}

Public String busInfo() {


Return “Bus No: “ + busNumber + “ | Destination: “ + destination
+ “ | Available Seats: “ + availableSeats + “/” + totalSeats
+ “ | Price: ₹” + ticketPrice + “ | Time: “ + time;
}
}

// User class to represent user details


Class User {
String username;
String fullName;
String phone;

Public User(String username, String fullName, String phone) {


This.username = username;
This.fullName = fullName;
This.phone = phone;
}
}

// Main class for the Bus Reservation System


Public class EnhancedBusReservationSystem extends JFrame {

Private static ArrayList<Bus> buses = new ArrayList<>();


Private static Map<String, ArrayList<Integer>> reservations = new
HashMap<>();
Private static Map<String, User> users = new HashMap<>();

Private JTextArea displayArea;


Private JTextField busNumberField;
Private JComboBox<String> destinationCombo;
Private JComboBox<String> sortCombo;
Private JTextField userNameField, phoneField, fullNameField;
Private JButton seatSelectionButton;
Private JLabel welcomeLabel;
17
Private String currentUser = null;

Private JTabbedPane tabPane;

Public EnhancedBusReservationSystem() {
// Initialize bus data
Buses.add(new Bus(101, “Mumbai”, 40, 500, “10:30 AM”));
Buses.add(new Bus(102, “Pune”, 35, 450, “12:00 PM”));
Buses.add(new Bus(103, “Nashik”, 45, 400, “1:30 PM”));
Buses.add(new Bus(104, “Aurangabad”, 30, 550, “3:00 PM”));

// Frame settings
setTitle(“Enhanced Bus Reservation System”);
setSize(800, 600);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);

// Creating Tabs
tabPane = new JTabbedPane();

// Login Panel
JPanel loginPanel = new JPanel(new GridLayout(4, 2, 5, 5));
JLabel usernameLabel = new JLabel(“Username:”);
userNameField = new JTextField(15);
JLabel fullNameLabel = new JLabel(“Full Name:”);
fullNameField = new JTextField(15);
JLabel phoneLabel = new JLabel(“Phone:”);
phoneField = new JTextField(15);
JButton loginButton = new JButton(“Login/Register”);
loginButton.addActionListener(e -> loginUser());

loginPanel.add(usernameLabel);
loginPanel.add(userNameField);
loginPanel.add(fullNameLabel);
loginPanel.add(fullNameField);
loginPanel.add(phoneLabel);
loginPanel.add(phoneField);
loginPanel.add(new JLabel(“”));
loginPanel.add(loginButton);

tabPane.add(“Login/Register”, loginPanel);

18
// Reservation Panel
JPanel reservationPanel = new JPanel(new BorderLayout());
welcomeLabel = new JLabel(“Welcome! Please log in to make
reservations.”);
reservationPanel.add(welcomeLabel, BorderLayout.NORTH);

JPanel reservationOptionsPanel = new JPanel(new FlowLayout());


JLabel busNumberLabel = new JLabel(“Bus Number:”);
busNumberField = new JTextField(5);
destinationCombo = new JComboBox<>(new String[]{“All”,
“Mumbai”, “Pune”, “Nashik”, “Aurangabad”});
sortCombo = new JComboBox<>(new String[]{“Sort by Price”,
“Sort by Availability”, “Sort by Time”});
seatSelectionButton = new JButton(“Select Seat”);
seatSelectionButton.setEnabled(false);

JButton searchButton = new JButton(“Search Buses”);


JButton reserveButton = new JButton(“Reserve Seat”);
JButton viewHistoryButton = new JButton(“View Reservation
History”);

reservationOptionsPanel.add(busNumberLabel);
reservationOptionsPanel.add(busNumberField);
reservationOptionsPanel.add(new JLabel(“Destination:”));
reservationOptionsPanel.add(destinationCombo);
reservationOptionsPanel.add(sortCombo);
reservationOptionsPanel.add(searchButton);
reservationOptionsPanel.add(reserveButton);
reservationOptionsPanel.add(seatSelectionButton);
reservationOptionsPanel.add(viewHistoryButton);

reservationPanel.add(reservationOptionsPanel,
BorderLayout.CENTER);

displayArea = new JTextArea();


displayArea.setEditable(false);
displayArea.setFont(new Font(“Arial”, Font.PLAIN, 14));
JScrollPane scrollPane = new JScrollPane(displayArea);
reservationPanel.add(scrollPane, BorderLayout.SOUTH);

tabPane.add(“Book Tickets”, reservationPanel);


// Button actions
searchButton.addActionListener(e -> displayBuses());
19
reserveButton.addActionListener(e -> reserveSeat());
seatSelectionButton.addActionListener(e ->
showSeatSelectionDialog());
viewHistoryButton.addActionListener(e ->
viewReservationHistory());

add(tabPane);
}

// Log in or register the user


Private void loginUser() {
String username = userNameField.getText().trim();
String fullName = fullNameField.getText().trim();
String phone = phoneField.getText().trim();

If (!username.isEmpty() && !fullName.isEmpty() && !


phone.isEmpty()) {
currentUser = username;
users.putIfAbsent(username, new User(username, fullName, phone));
welcomeLabel.setText(“Welcome, “ + fullName + “!”);
seatSelectionButton.setEnabled(true);
JOptionPane.showMessageDialog(this, “Login successful.”);
} else {
JOptionPane.showMessageDialog(this, “Please fill in all fields.”);
}
}
// Display available buses based on filters
Private void displayBuses() {
String selectedDestination = (String)
destinationCombo.getSelectedItem();
displayArea.setText(“Available Buses:\n”);
for (Bus bus : buses) {
if (selectedDestination.equals(“All”) ||
bus.destination.equals(selectedDestination)) {
displayArea.append(bus.busInfo() + “\n”);
}
}
}
// Reserve a seat
Private void reserveSeat() {
If (currentUser != null) {
Try {
Int busNum = Integer.parseInt(busNumberField.getText());
20
For (Bus bus : buses) {
If (bus.busNumber == busNum) {
If (bus.reserveSeat()) {
Reservations.putIfAbsent(currentUser, new ArrayList<>());
Reservations.get(currentUser).add(busNum);
JOptionPane.showMessageDialog(this, “Reservation successful for
Bus “ + busNum + “.”);
} else {
JOptionPane.showMessageDialog(this, “No seats available on Bus “
+ busNum + “.”);
}
displayBuses();
return;
}
}
JOptionPane.showMessageDialog(this, “Bus not found.”);
} catch (NumberFormatException e) {
JOptionPane.showMessageDialog(this, “Invalid bus number.”);
}
} else {
JOptionPane.showMessageDialog(this, “Please login first.”);
}
}
// Show seat selection dialog
Private void showSeatSelectionDialog() {
JOptionPane.showMessageDialog(this, “Seat selection feature
coming soon!”);
}
// View reservation history for the logged-in user
Private void viewReservationHistory() {
If (currentUser != null) {
displayArea.setText(“Reservation History for “ + currentUser + “:\
n”);
ArrayList<Integer> userReservations = reservations.get(currentUser);
If (userReservations != null && !userReservations.isEmpty()) {
For (Integer busNumber : userReservations) {
displayArea.append(“Bus Number: “ + busNumber + “\n”);
}
} else {
displayArea.append(“No reservations found.\n”);
}
} else {
JOptionPane.showMessageDialog(this, “Please login first.”);
21
}
}
// Main method to run the application
Public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
EnhancedBusReservationSystem app = new
EnhancedBusReservationSystem();
App.setVisible(true);
});
}
}
Chapter 8 – Output

22
Chapter 6 – Conclusion

It can be observed that computer applications are very important in every field of
human endeavor. Here all the information about customer that made reservation can be gotten
just by clicking a button with this new system, some of the difficulties encountered with
the manual system are overcome.

It will also reduce the workload of the staff, reduce the time used for making
reservation at the bus terminal and also increase efficiency. The application also has the ability
to update records in various files automatically thereby relieving the company’s staff the
stress of working .

23
Chapter 7 – Reference

We were discussed about are project and from it we were searched over are syllabus. From the syllabus and
from internet we collected some information about are project

● Following are some sites from we collected the information :-

● REFERENCE :-
1.https://github.com/topics/bus-reservation-system
2.https://www.codeproject.com/

***

24

You might also like