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

Java

Uploaded by

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

Java

Uploaded by

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

A

Micro- Project Report

On

“Development 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
Development 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

Development 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 java.io.*;

public class BusReservationAndTicketingSystem {

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

BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

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;){

System.out.print("Enter User: ");

user = in.readLine();

System.out.print("Enter Password: ");

password = in.readLine();

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

available[o]=20;

if(user.equals("1") && password.equals("1")){

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

System.out.println("********************************************");

System.out.println("** BUS RESERVATION AND TICKETING SYSTEM **");

System.out.println("********************************************");

System.out.println("** [1] Destination **");

System.out.println("** [2] Passengers **");

System.out.println("** [3] Billing **");

System.out.println("** [4] View **");

System.out.println("** [5] Exit **");

6
System.out.println("***************************************");

System.out.println("***************************************\n");

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

System.out.print("ENTER CHOICE: ");

choice=in.readLine();

if (choice.equals("1")){

//the DESTINATION DETAILS//

System.out.println("***************************************");

System.out.println("** DESTINATION | FARE | SEAT **");

System.out.println("***************************************");

System.out.println("** 1.)DAVAO CITY | Php600 | "+available[1]+" **");

System.out.println("** 2.)BUTUAN CITY | Php170 | "+available[2]+" **");

System.out.println("** 3.)CABADBARAN | Php150 | "+available[3]+" **");

System.out.println("** 4.)TANDAG | Php200 | "+available[4]+" **");

System.out.println("** 5.)CAGAYAN | Php250 | "+available[5]+" **");

System.out.println("***************************************");

System.out.println("***************************************\n");

System.out.println("PWD, STUDENT, & SENIOR CITIZEN with 20% DISCOUNT!!!\n");

x=0;

else if (choice.equals("2")){

int print=1;

//display first the Destination Details//

System.out.println("***************************************");

System.out.println("** DESTINATION | FARE | SEAT **");

System.out.println("***************************************");

System.out.println("** 1.)DAVAO CITY | Php600 | "+available[1]+" **");

System.out.println("** 2.)BUTUAN CITY | Php170 | "+available[2]+" **");

System.out.println("** 3.)CABADBARAN | Php150 | "+available[3]+" **");

System.out.println("** 4.)TANDAG | Php200 | "+available[4]+" **");

System.out.println("** 5.)CAGAYAN | Php250 | "+available[5]+" **");

7
System.out.println("***************************************");

System.out.println("***************************************\n");

System.out.println("PWD, STUDENT, & SENIOR CITIZEN with 20% DISCOUNT!!!\n");

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

System.out.println("Sorry, We don't have available seats for all Destination!");

x=0;

}else{

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

System.out.print("\nENTER PASSENGER'S NAME: ");

ticketS[z][0] = in.readLine();

x=0;

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

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

System.out.println("Sorry, Passenger's name have already used!");

x=1;

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

System.out.print("ENTER DESTINATION: ");

to = Integer.parseInt(in.readLine());

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

System.out.println("Invalid Input!");

x=1;

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

if(to==d){

if(available[to]==0){

System.out.println("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;){

System.out.print("HOW MANY PASSENGERS ARE YOU?: ");

ticketI[z][0] = Integer.parseInt(in.readLine());

//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){

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

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

System.out.print("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;){

System.out.print("HOW MANY PASSENGERS HAVE DISCOUNT?: ");

ticketI[z][1] = Integer.parseInt(in.readLine());

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

System.out.println("Invalid Input!");

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

x=1;

else{

break;

//print out of passengers details....

if(print==1){

System.out.println("\n***************************************");

System.out.println("** PASSENGER'S DETAILS **");

System.out.println("***************************************");

System.out.println("PASSENGER'S NAME: " + ticketS[z][0]);

System.out.println("PASSENGER'S DESTINATION : " + ticketS[z][1]);

System.out.println("FARE PRICE: Php " + ticketD[z][0]);

System.out.println("NO. OF PASSENGERS: " + ticketI[z][0]);

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

System.out.println("***************************************");

System.out.println("***************************************\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 (choice.equals("3")){

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

System.out.print("ENTER PASSENGER'S NAME: ");

search = in.readLine();

int s=1;

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

if(search.equalsIgnoreCase(ticketS[b][0])){

System.out.println("***************************************");

System.out.println("** PASSENGER'S DETAILS **");

System.out.println("***************************************");

System.out.println("PASSENGER'S NAME: " + ticketS[b][0]);

System.out.println("PASSENGER'S DESTINATION : " + ticketS[b][1]);

System.out.println("FARE PRICE: Php" + ticketD[b][0]);

System.out.println("NO. OF PASSENGERS: " + ticketI[b][0]);

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

System.out.println("***************************************");

System.out.println("***************************************");

s=0;

x=0;

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

System.out.println("Passenger's Already Paid!");

x=0;

else{

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

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

11
System.out.println("\nPASSENGER'S TOTAL FARE: Php "+ticketD[b][2]);

System.out.print("ENTER AMOUNT TO PAY: ");

pay[b] = Double.parseDouble(in.readLine());

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

if(change[b]<0){

System.out.println("Invalid Input!");

x=1;

else{

System.out.println("CHANGE: Php "+change[b]);

System.out.println("");

x=0;

if (s==1){

System.out.println("\nPASSENGER'S NAME NOT FOUND!\n");

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

System.out.print("Do you wish to continue with this transaction? [Y/N]: ");

again=in.readLine();

if(again.equalsIgnoreCase("y")){

q=0;

else if (again.equalsIgnoreCase("n")){

q=0;

x=0;

else{

System.out.println("\nInvalid input!\n");

12
}

else if (choice.equals("4")){

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

System.out.print("SEARCH PASSENGER'S NAME: ");

search = in.readLine();

int s=1;

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

if(search.equalsIgnoreCase(ticketS[x][0])){

System.out.println("***************************************");

System.out.println("** PASSENGER'S DETAILS **");

System.out.println("***************************************");

System.out.println("PASSENGER'S NAME: " + ticketS[x][0]);

System.out.println("PASSENGER'S DESTINATION : " + ticketS[x][1]);

System.out.println("FARE PRICE: Php" + ticketD[x][0]);

System.out.println("NO. OF PASSENGERS: " + ticketI[x][0]);

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

System.out.println("TOTAL FARE PRICE: Php " + ticketD[x][2]);

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

System.out.println("PAY: Php " +pay[x]);

System.out.println("CHANGE: Php " +change[x]);

System.out.println("STATUS: PAID");

else{

System.out.println("STATUS: NOT PAID");

System.out.println("***************************************");

System.out.println("***************************************");

13
s=0;

sx=4;

if (s==1){

System.out.println("Passenger's Name not found!");

sx++;

else if(choice.equals("5")){

end=1;

x=0;

System.out.println("Thank You!");

else{

System.out.println("Invalid Input!");

x=1;

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

if(end==1){

break;

System.out.print("Do you want another transaction? [Y/N]: ");

yn = in.readLine();

if (yn.equalsIgnoreCase("y")){

x=1;

y=0;

14
else if (yn.equalsIgnoreCase("n")){

System.out.println("\nThank You!!!");

break;

else{

System.out.println("Invalid Input!!!");

y=1;

i=4;

else{

System.out.println("\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

You might also like