0% found this document useful (0 votes)
30 views18 pages

Java Bus Reservation System Project

Uploaded by

xyz935613
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)
30 views18 pages

Java Bus Reservation System Project

Uploaded by

xyz935613
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

Micro- Project Report

On

“Develop Bus Reservation System Using Java.”

Submitted by,

Jay Jain (2215810108)

Ansh khot (2215810109)

Tanvi joshi (23152460313)

Under The Guidance of


Miss .Shruti Sakpal

Department of Computer Engineering

SMT. GEETA D. TATKARE POLYTECHNIC KOLAD- RAIGAD

2023-24

1
Annexure – I A
PART A
Micro-Project Proposal
4th Semester
Develop Bus Reservation System Using Java

1.0 Brief Introduction


This system is easy to understand and handle. Here, you have to enter the details of
your journey. There are a lot of features to this project. From booking to canceling
tickets, you can do that in this system. The users can report the problem to the admin.
You can also check the statistics of your office. The admin can manage the number of
buses he/she wants to add.

There are two parts of the system, one as an admin and the other as user. To use the
system as admin you have to log in to the system. Enter the admin id and password to
get access to the system. Talking about the user perspective, the user can simply book
the ticket. He/she should first choose the destination they want to travel. Once they
select the destination, thereafter, they can select the type of bus service they and also
the route through they want to travel. After selecting all they can head towards the
confirmation of the ticket.
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.

2
2.0 Aim of the Micro-Project

1) To develop programming skills


2) To Understand Logic of the Program.
3) Increase The Ticket Booking efficiency.

3.0 Action Plan

S. No. Details of activity Planned Planned Name of


Start date Finish Responsible Team
date Members
1. Topic assignment and approval of aim 22/1/24 27/1/24 Jay jain
2. Making of action plan and work on 29/1/24 3/2/24 Tanvi joshi
annexure-1
3. Searching of related information 5/2/24 10/2/24 Ansh khot
4. Collection of related information 20/2/24 24/2/24 All group members
5. Arrange the information 26/2/24 2/3/24 Jay jain
6. Work on report presentation 4/3/24 9/3/24 Tanvi joshi
7. Preparation of annexure II 11/3/24 16/3/24 All group members
8. Approval of annexure II 18/3/24 23/3/24 All group members

4.0 Resources Required

S. No. Name of Specifications Qty Remarks


Resource/material
1 Computer Windows10,RAM 4GB 1 available

2 Software Jdk10.0.18363 1 available

3 Internet connection standard - available

4 Notepad application standard 1 available

3
PART B Annexure – IIA

Develop Bus Reservation System Using Java


1. Brief Description
This project is meant to delineate the features of Online Bus Ticket Booking, so as to
serve as a guide to the developers on one hand and a software validation document for
the prospective client on the other. The Bus Reservation System is developed for
Travellers to reserve seats online and to save them from hassles. It will allow the
passengers to enjoy the booking of bus tickets from the present position through the
internet. They will be provided with the bus routes along with some other facilities like
booking the tickets based on their comfort level, the time of arrival and departure, and
canceling the tickets. The administrator can handle various aspects like applying the
offers, changing the facilities according to price, can monitor various other things. The
Travel Agency can also use this application for managing their ticket booking service.
This Bus Ticket Booking application can be used by any Travel Agent to issue tickets to
customers. It also helps the customer to enquire about the availability of seats in a
particular bus at a particular date from a particular location. It will also provide the
facility to check the timings and schedule of the buses along with the ticket price.
The passenger will log in and will enter the source, destination, and date. The system
will show all the buses from that route reaching the entered destination along with the
bus type and the seats available for booking along with the fair. The passenger will
choose the bus seat according to their comfort and choice. The payment will be done
and the online bus ticket will be generated and will be sent to the email address of the
user. The user will also be provided with the ticket cancelation option.

Constructor : In Java, a constructor is a block of codes similar to the method. It is called


when an instance of the class is created. At the time of calling constructor, memory for
the object is allocated in the memory.

It is a special type of method which is used to initialize the object.

Every time an object is created using the new() keyword, at least one constructor is called.

4
2.0 Aim of Micro Project
1) To develop programming skills
2) To Understand Logic of the Program.
Increase The Ticket Booking efficiency

3.0 Course Outcomes Integrated

1) Develop program using object oriented methodology in java


2) Apply concept of inheritance for code reusability
3) Implement exception handling
4) Develop programs for handling I/O and file streams

4.0 Actual Procedure Followed


Algorithm:-
Here's a simple algorithm for a bus reservation system in Java:

1. Create a Bus class with attributes like bus Number, source, destination, total Seats, and
available Seats.
2. Create a Reservation class with attributes like passenger Name, passenger Age,
passenger Gender, bus Number, and seat Number.
3. Create a main class Bus Reservation System to handle the user interface and user
input/output.
4. In the main class, create an array of Bus objects to store information about different
buses.
5. display all the buses When a user reserves a seat, the available Seats attribute of that
bus should be decremented, and when a user cancels a seat, the available Seats attribute
should be incremented.
6. Display all the passengers or search for a particular passenger.
7. Save all the data in a file so that it can be accessed even after the program is closed.
Program:

5
import [Link].*;

public class BusReservationAndTicketingSystem {

public static void main(String args[]) throws IOException {

BufferedReader in = new BufferedReader(new InputStreamReader([Link]));

String user,password,yn,search,again,choice;

int to=0,y=1,z=0,end=0,r=1;

int available[] = new int[6];

int ticketI[][] = new int [100][3];

String ticketS[][] = new String[100][3];

double ticketD[][] = new double [100][3];

double pay[] = new double[20];

double change[] = new double[20];

try{

for(int i=1;i<4;){

[Link]("Enter User: ");

user = [Link]();

[Link]("Enter Password: ");

password = [Link]();

for(int o=1; o<=5; o++){

available[o]=20;

if([Link]("1") && [Link]("1")){

for(int x=1; x==1;){

[Link]("********************************************");

[Link]("** BUS RESERVATION AND TICKETING SYSTEM **");

[Link]("********************************************");

[Link]("** [1] Destination **");

[Link]("** [2] Passengers **");

[Link]("** [3] Billing **");

[Link]("** [4] View **");

[Link]("** [5] Exit **");

6
[Link]("***************************************");

[Link]("***************************************\n");

for(x=1; x==1;){

[Link]("ENTER CHOICE: ");

choice=[Link]();

if ([Link]("1")){

//the DESTINATION DETAILS//

[Link]("***************************************");

[Link]("** DESTINATION | FARE | SEAT **");

[Link]("***************************************");

[Link]("** 1.)DAVAO CITY | Php600 | "+available[1]+" **");

[Link]("** 2.)BUTUAN CITY | Php170 | "+available[2]+" **");

[Link]("** 3.)CABADBARAN | Php150 | "+available[3]+" **");

[Link]("** 4.)TANDAG | Php200 | "+available[4]+" **");

[Link]("** 5.)CAGAYAN | Php250 | "+available[5]+" **");

[Link]("***************************************");

[Link]("***************************************\n");

[Link]("PWD, STUDENT, & SENIOR CITIZEN with 20% DISCOUNT!!!\n");

x=0;

else if ([Link]("2")){

int print=1;

//display first the Destination Details//

[Link]("***************************************");

[Link]("** DESTINATION | FARE | SEAT **");

[Link]("***************************************");

[Link]("** 1.)DAVAO CITY | Php600 | "+available[1]+" **");

[Link]("** 2.)BUTUAN CITY | Php170 | "+available[2]+" **");

[Link]("** 3.)CABADBARAN | Php150 | "+available[3]+" **");

[Link]("** 4.)TANDAG | Php200 | "+available[4]+" **");

[Link]("** 5.)CAGAYAN | Php250 | "+available[5]+" **");

7
[Link]("***************************************");

[Link]("***************************************\n");

[Link]("PWD, STUDENT, & SENIOR CITIZEN with 20% DISCOUNT!!!\n");

if((available[1]==0)&&(available[2]==0)&&(available[3]==0)&&(available[4]==0)&&(available[5]
==0)){

[Link]("Sorry, We don't have available seats for all Destination!");

x=0;

}else{

for(x=1; x==1;){

[Link]("\nENTER PASSENGER'S NAME: ");

ticketS[z][0] = [Link]();

x=0;

for(int l=0; l<z; l++){

if(ticketS[l][0].equalsIgnoreCase(ticketS[z][0])){

[Link]("Sorry, Passenger's name have already used!");

x=1;

for(x=1; x==1;){

[Link]("ENTER DESTINATION: ");

to = [Link]([Link]());

if(to<1 || to>5){

[Link]("Invalid Input!");

x=1;

for(int d=1; d<=5; d++){

if(to==d){

if(available[to]==0){

[Link]("Sorry, We don't have available seat!");

x=1;

8
}

x=0;

String dest[] = { " ", "DAVAO CITY", "BUTUAN CITY", "CABADBARAN", "TANDAG",
"CAGAYAN"};

double fare[] = { 0,600,170,150,200,250};

ticketS[z][1] = dest[to];

ticketD[z][0] = fare[to];

for(x=1; x==1;){

[Link]("HOW MANY PASSENGERS ARE YOU?: ");

ticketI[z][0] = [Link]([Link]());

//subtract the available seat by the the number inputed//

for(int p=1; p<=5; p++){

if(to==p){

print=1;

available[to] = available[to]-ticketI[z][0];

//if the subtracted available seat is "<0", display error//

//add the inputed number to the subtracted seat, to back the original seat//

//display the available seat and back to the inputing//

if(available[to]<0){

[Link]("Sorry, We don't have seat available for " +ticketI[z][0] +" person\n");

available[to] = available[to]+ticketI[z][0];

[Link]("We only have " +available[to] +" seat available\n");

x=1;

print=0;

else{

x=0;

9
}

}}

//inputing for Number of Discounted Passenger's//

for(x=1;x==1;){

[Link]("HOW MANY PASSENGERS HAVE DISCOUNT?: ");

ticketI[z][1] = [Link]([Link]());

if(ticketI[z][1]>ticketI[z][0]){

[Link]("Invalid Input!");

[Link]("No. of Passengers are only " +ticketI[z][0] +"!");

x=1;

else{

break;

//print out of passengers details....

if(print==1){

[Link]("\n***************************************");

[Link]("** PASSENGER'S DETAILS **");

[Link]("***************************************");

[Link]("PASSENGER'S NAME: " + ticketS[z][0]);

[Link]("PASSENGER'S DESTINATION : " + ticketS[z][1]);

[Link]("FARE PRICE: Php " + ticketD[z][0]);

[Link]("NO. OF PASSENGERS: " + ticketI[z][0]);

[Link]("NO. OF PASSENGERS WITH DISCOUNT: " + ticketI[z][1]);

[Link]("***************************************");

[Link]("***************************************\n");

ticketS[z][2]="0";

double discount=(ticketD[z][0]-(ticketD[z][0]*0.2))*ticketI[z][1];

ticketD[z][2]= ((ticketI[z][0]-ticketI[z][1])*ticketD[z][0])+discount;

10
x=0;

z++;

else if ([Link]("3")){

for(x=1; x==1;){

[Link]("ENTER PASSENGER'S NAME: ");

search = [Link]();

int s=1;

for(int b=0;b<z;b++){

if([Link](ticketS[b][0])){

[Link]("***************************************");

[Link]("** PASSENGER'S DETAILS **");

[Link]("***************************************");

[Link]("PASSENGER'S NAME: " + ticketS[b][0]);

[Link]("PASSENGER'S DESTINATION : " + ticketS[b][1]);

[Link]("FARE PRICE: Php" + ticketD[b][0]);

[Link]("NO. OF PASSENGERS: " + ticketI[b][0]);

[Link]("NO. OF PASSENGERS WITH DISCOUNT: " + ticketI[b][1]);

[Link]("***************************************");

[Link]("***************************************");

s=0;

x=0;

if(ticketS[b][2].equals("x")){

[Link]("Passenger's Already Paid!");

x=0;

else{

ticketS[b][2]="x";

for(x=1; x==1;){

11
[Link]("\nPASSENGER'S TOTAL FARE: Php "+ticketD[b][2]);

[Link]("ENTER AMOUNT TO PAY: ");

pay[b] = [Link]([Link]());

change[b]=pay[b]-ticketD[b][2];

if(change[b]<0){

[Link]("Invalid Input!");

x=1;

else{

[Link]("CHANGE: Php "+change[b]);

[Link]("");

x=0;

if (s==1){

[Link]("\nPASSENGER'S NAME NOT FOUND!\n");

for(int q=1; q==1;){

[Link]("Do you wish to continue with this transaction? [Y/N]: ");

again=[Link]();

if([Link]("y")){

q=0;

else if ([Link]("n")){

q=0;

x=0;

else{

[Link]("\nInvalid input!\n");

12
}

else if ([Link]("4")){

for(int sx=1; sx<=3;){

[Link]("SEARCH PASSENGER'S NAME: ");

search = [Link]();

int s=1;

for(x=0; x<=z; x++){

if([Link](ticketS[x][0])){

[Link]("***************************************");

[Link]("** PASSENGER'S DETAILS **");

[Link]("***************************************");

[Link]("PASSENGER'S NAME: " + ticketS[x][0]);

[Link]("PASSENGER'S DESTINATION : " + ticketS[x][1]);

[Link]("FARE PRICE: Php" + ticketD[x][0]);

[Link]("NO. OF PASSENGERS: " + ticketI[x][0]);

[Link]("NO. OF PASSENGERS WITH DISCOUNT: " + ticketI[x][1]);

[Link]("TOTAL FARE PRICE: Php " + ticketD[x][2]);

if(ticketS[x][2].equals("x")){

[Link]("PAY: Php " +pay[x]);

[Link]("CHANGE: Php " +change[x]);

[Link]("STATUS: PAID");

else{

[Link]("STATUS: NOT PAID");

[Link]("***************************************");

[Link]("***************************************");

13
s=0;

sx=4;

if (s==1){

[Link]("Passenger's Name not found!");

sx++;

else if([Link]("5")){

end=1;

x=0;

[Link]("Thank You!");

else{

[Link]("Invalid Input!");

x=1;

for(y=1; y==1;){

if(end==1){

break;

[Link]("Do you want another transaction? [Y/N]: ");

yn = [Link]();

if ([Link]("y")){

x=1;

y=0;

14
else if ([Link]("n")){

[Link]("\nThank You!!!");

break;

else{

[Link]("Invalid Input!!!");

y=1;

i=4;

else{

[Link]("\nInvalid user or password!\n");

i++;

Catch (execption e)

15
5.0 Actual Resources Used

S. No. Name of Specifications Qty Remarks


Resource/material
1 Computer Windows10,RAM 4GB 1 available

2 Software Jdk10.0.18363 1 available

3 Internet connection standard - available

4 Notepad application standard 1 available

6.0 Outputs of the Micro-Project

16
17
7.0 Skill Developed / learning out of this Micro-Project

1. We developed our learning skills about New Topic.


2. Developed Communications Skills.
3. Learned how to make Report.
4. Learned Group Discussion.

****************

18

Common questions

Powered by AI

The system implements a 20% discount for special categories such as students, seniors, and persons with disabilities. During the booking process, users can specify the number of passengers eligible for discounts. The price calculation reduces the fare for these passengers by 20%. The system checks for available seats and reassesses the price based on the number of discounted tickets versus standard fare tickets, ensuring accurate billing and seat allocation .

The absence of external database connectivity in the Bus Reservation System influences its design and functionality by limiting the complexity and scalability of data operations. The system relies on file-based storage for data persistence, which simplifies implementation but restricts features like complex query processing, multi-user transaction management, and scalability seen in database-backed applications. Moreover, while it reduces resource overhead and simplifies maintenance, it also poses challenges for data integrity, concurrency control, and real-time data updates essential in dynamic environments .

The development of the Bus Reservation System enhances programming skills by engaging developers in practical Java programming, focusing on object-oriented design, algorithm implementation, exception handling, and user interface creation. The project encourages developers to solve real-world problems, apply coding standards, and learn through the iterative process of developing, testing, and refining system features. This hands-on experience with project-based learning strengthens understanding and proficiency in Java .

The Bus Reservation System effectively meets its primary aim of increasing ticket booking efficiency by automating and streamlining the booking process. Users can quickly select destinations, bus types, and personal preferences online, reducing the operational load on travel agencies and minimizing human error. Additionally, the system's admin capabilities, such as seat management and pricing adjustment, further enhance efficiency. However, the lack of a GUI interface and reliance on a console-based application could limit user accessibility and system scalability in a commercial setting .

The admin in the Bus Reservation System is responsible for logging into the system, managing the number of buses by adding or removing them, handling user reports about problems, applying offers, changing facilities according to price, and monitoring various system functions. Additionally, the admin can view all passengers' records and manage bookings efficiently without external database connectivity .

Incorporating both user and admin perspectives in the Bus Reservation System is crucial for maintaining a comprehensive and scalable application. The user perspective allows passengers to book and cancel tickets, choose routes and bus types according to their preferences, and view fare details. On the other hand, the admin perspective provides the ability to add, modify, or remove bus schedules, apply discounts, manage passenger reports, and ensure the system operates smoothly. This dual-perspective design ensures the system meets both operational and customer service needs, enhancing user experience and system efficiency .

The Bus Reservation System employs data persistence strategies by saving all booking and passenger information in flat files, allowing data recovery after system shutdowns. This method is crucial as it retains essential information such as booking records, seat availability, and passenger details. While it might not support complex queries like databases, it ensures data retention across sessions and provides a simple mechanism for backup and restore operations. This approach effectively meets the project's goals given its constraints of not using an external database .

Algorithm development is fundamental to the successful implementation of the Java-based Bus Reservation System as it establishes a clear procedural framework for operations like ticket booking, seat cancellation, and record maintenance. A well-designed algorithm ensures that tasks such as updating seat availability, applying discounts, and processing payments are executed efficiently and accurately. The algorithm's efficiency impacts system responsiveness and overall user satisfaction, as it allows seamless handling of user requests and minimizes errors in booking operations. The integration of object-oriented concepts within the algorithm also enhances code reusability and maintenance .

The Bus Reservation System integrates object-oriented programming concepts by utilizing Java classes such as Bus and Reservation. The Bus class includes attributes like bus number, source, destination, and seat information. The Reservation class manages passenger details such as name, age, and seat allocation. These encapsulate data and behaviors relevant to the system, utilizing inheritance for modularity and polymorphism for flexibility in method implementation. Exception handling is used to manage errors in operations like booking and cancelling .

The action plan and timeline structure the development process, ensuring that each phase of the Bus Reservation System project is methodically approached and completed on schedule. By allocating specific start and end dates for tasks such as topic assignment, information gathering, and report preparation, team members can focus on achieving deliverables sequentially. It promotes efficient collaboration, accountability, and timely progress, facilitating systematic development and mitigating delays or resource constraints .

You might also like