0% found this document useful (0 votes)
27 views8 pages

Journey With Train

reailway reservation console application

Uploaded by

Arun Arasan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views8 pages

Journey With Train

reailway reservation console application

Uploaded by

Arun Arasan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Journey with Train

1. Project Overview

 Project Name: Journey With Train


 Description:
o This system manages railway operations including train scheduling, booking,
cancellations, station management, and more.
 Features:
o Train management: Adding, updating, and managing trains.
o Booking management: Passenger booking, cancellation.
o Station management: Handling station operations including platforms,
tracks, and schedules.
o Passenger management: Storing and managing passenger information.
o Schedule management: Creating and managing train schedules.
 Technology Stack:
o Backend: Java
o Database: MySQL
o Tools: JDBC for database connections.

Prerequisites:

To get started with the Journey with Train project, you'll need to have the following
prerequisites installed on your system:
 Java Development Kit (JDK): Ensure you have JDK 8 or later installed on your
system.
 MySQL Database: Install MySQL Community Server 8.0 or later to use as the
database for the project.
 Integrated Development Environment (IDE): We'll be using Eclipse as the IDE
for this project. You can download and install the latest version of Eclipse from the
official website.
 Git: Install Git on your system to clone the repository and manage version control.

Installation:

To set up the project, follow these steps:


1. Clone the Repository: Open a terminal or command prompt and clone the
repository using the following command:
Sh`` 1 git clone https://github.com/Arunarasan/Railway-management
This will download the entire project repository to your local system.
2. Set up the Database: Follow the instructions below to set up the MySQL
database.

Database Setup:

To set up the MySQL database, follow these steps:

Step 1: Create a New Database

Open a terminal or command prompt and connect to your MySQL server using the
following command:

MySQL -u root -p

Enter your root password when prompted.

Create a new database using the following command:

CREATE DATABASE Railways;

Replace Railways with the name of your database.

Step 2: Create Tables

Create the necessary tables in your database using the following SQL script:

3. Station
o station_id (INT, PRIMARY KEY, AUTO_INCREMENT)
o station_name (VARCHAR(100), NOT NULL)
o location (VARCHAR(255))
o city (VARCHAR(100))
o state (VARCHAR(100))
o created_at (TIMESTAMP, DEFAULT CURRENT_TIMESTAMP)
4. Platform
o platform_id (INT, PRIMARY KEY, AUTO_INCREMENT)
o platform_number (INT, NOT NULL)
o station_id (INT, FOREIGN KEY REFERENCES Station(station_id))
o platform_length (DECIMAL(10, 2))
o platform_type (VARCHAR(50))
o is_active (BOOLEAN, DEFAULT TRUE)
o created_at (TIMESTAMP, DEFAULT CURRENT_TIMESTAMP)
5. Track
o track_id (INT, PRIMARY KEY, AUTO_INCREMENT)
o platform_id (INT, FOREIGN KEY REFERENCES Platform(platform_id))
6. Engine
o engine_id (INT, PRIMARY KEY, AUTO_INCREMENT)
o engine_number (VARCHAR(50), NOT NULL, UNIQUE)
o engine_type (VARCHAR(50), NOT NULL)
o manufacturer (VARCHAR(100))
o horsepower (INT)
o build_year (YEAR)
o status (VARCHAR(50))
o created_at (TIMESTAMP, DEFAULT CURRENT_TIMESTAMP)
7. Train
o train_id (INT, PRIMARY KEY, AUTO_INCREMENT)
o train_number (VARCHAR(50), NOT NULL, UNIQUE)
o train_name (VARCHAR(100))
o train_type (VARCHAR(50))
o engine_id (INT, FOREIGN KEY REFERENCES Engine(engine_id))
o total_coaches (INT)
o status (VARCHAR(50))
o created_at (TIMESTAMP, DEFAULT CURRENT_TIMESTAMP)
8. Schedule
o schedule_id (INT, PRIMARY KEY, AUTO_INCREMENT)
o train_id (INT, FOREIGN KEY REFERENCES Train(train_id))
o track_id (INT, FOREIGN KEY REFERENCES Track(track_id))
o arrival_time (TIME)
o depart_time (TIME)
o arrival_date (DATE)
o depart_date (DATE)
o fare (DECIMAL(10, 2))
9. Compartment
o compartment_id (INT, PRIMARY KEY, AUTO_INCREMENT)
o train_id (INT, FOREIGN KEY REFERENCES Train(train_id))
o compartment_no (VARCHAR(50), NOT NULL)
o compartment_type (VARCHAR(50))
o compartment_length (INT)
o compartment_breadth (INT)
o AC (BOOLEAN)
10. Seat
o seat_id (INT, PRIMARY KEY, AUTO_INCREMENT)
o seat_no (VARCHAR(50), NOT NULL)
o compartment_id (INT, FOREIGN KEY REFERENCES
Compartment(compartment_id))
o seat_type (VARCHAR(50))
o length (INT)
o pos_row (INT)
o pos_column (INT)
11. Path
o path_id (INT, PRIMARY KEY, AUTO_INCREMENT)
o path_length (INT)
o path_breadth (INT)
o path_row (INT)
o path_col (INT)
o compartment_id (INT, FOREIGN KEY REFERENCES
Compartment(compartment_id))
12. Restroom
o toilet_id (INT, PRIMARY KEY, AUTO_INCREMENT)
o length (INT)
o breadth (INT)
o toilet_row (INT)
o compartment_id (INT, FOREIGN KEY REFERENCES
Compartment(compartment_id))
13. Door
o door_id (INT, PRIMARY KEY, AUTO_INCREMENT)
o door_row (INT)
o door_length (INT)
o compartment_id (INT, FOREIGN KEY REFERENCES
Compartment(compartment_id))
14. Exit
o exit_id (INT, PRIMARY KEY, AUTO_INCREMENT)
o exit_row (INT)
o exit_length (INT)
o compartment_id (INT, FOREIGN KEY REFERENCES
Compartment(compartment_id))
15. Cabin
o cabin_id (INT, PRIMARY KEY, AUTO_INCREMENT)
o cabin_no (VARCHAR(50), NOT NULL)
o length (INT)
o breadth (INT)
o cabin_row (INT)
o compartment_id (INT, FOREIGN KEY REFERENCES
Compartment(compartment_id))
16. Sleeper
o sleeper_id (INT, PRIMARY KEY, AUTO_INCREMENT)
o sleeper_no (VARCHAR(50), NOT NULL)
o sleeper_type (VARCHAR(50))
o sleeper_row (INT)
o length (INT)
o pos_row (INT)
o compartment_id (INT, FOREIGN KEY REFERENCES
Compartment(compartment_id))
17. SleeperinCabin
o sleeper_id (INT, PRIMARY KEY, AUTO_INCREMENT)
o sleeper_no (VARCHAR(50), NOT NULL)
o sleeper_type (VARCHAR(50))
o position (VARCHAR(50))
o cabin_id (INT, FOREIGN KEY REFERENCES
18. User
o user_id (INT, PRIMARY KEY, AUTO_INCREMENT)
o first_name (VARCHAR(50), NOT NULL)
o last_name (VARCHAR(50), NOT NULL)
o email_id (VARCHAR(100), UNIQUE, NOT NULL)
o phone_no (VARCHAR(15))
o adhaar_no (VARCHAR(12), UNIQUE)
o password (VARCHAR(255), NOT NULL)
o gender (CHAR(1))
o language (VARCHAR(50))
o dob (DATE)
19. Employee
o employee_id (INT, PRIMARY KEY, AUTO_INCREMENT)
o employee_no (VARCHAR(50), UNIQUE, NOT NULL)
o employee_name (VARCHAR(100), NOT NULL)
o employee_role (VARCHAR(50), NOT NULL)
20. EmployeeFamily
o employee_id (INT, FOREIGN KEY REFERENCES Employee(employee_id))
o relation (VARCHAR(50))
o name (VARCHAR(100))
o gender (CHAR(1))
21. GovtServants
o servants_id (INT, PRIMARY KEY, AUTO_INCREMENT)
o govt_id (VARCHAR(50), UNIQUE, NOT NULL)
o govt_role (VARCHAR(50))
o name (VARCHAR(100), NOT NULL)
o gender (CHAR(1))
22. Student
o student_id (INT, PRIMARY KEY, AUTO_INCREMENT)
o student_name (VARCHAR(100), NOT NULL)
o student_qualification (VARCHAR(100))
o student_proof (VARCHAR(255))
o gender (CHAR(1))
23. PwD
o pwd_id (INT, PRIMARY KEY, AUTO_INCREMENT)
o pwd_no (VARCHAR(50), UNIQUE, NOT NULL)
o pwd_certificate (VARCHAR(255))
o name (VARCHAR(100), NOT NULL)
o gender (CHAR(1))
24. Passenger
o passenger_id (INT, PRIMARY KEY, AUTO_INCREMENT)
o passenger_name (VARCHAR(100), NOT NULL)
o age (INT)
o gender (VARCHAR(10))
25. PassengerVSStudent
o passenger_id (INT, FOREIGN KEY REFERENCES Passenger(passenger_id))
o student_id (INT, FOREIGN KEY REFERENCES Student(student_id))
26. PassengerVSPwd
o passenger_id (INT, FOREIGN KEY REFERENCES Passenger(passenger_id))
o pwd_id (INT, FOREIGN KEY REFERENCES PwD(pwd_id))
27. PassengerVSEmployee
o passenger_id (INT, FOREIGN KEY REFERENCES Passenger(passenger_id))
o employee_id (INT, FOREIGN KEY REFERENCES Employee(employee_id))
28. PassengerVSGovtServants
o passenger_id (INT, FOREIGN KEY REFERENCES Passenger(passenger_id))
o servent_id (INT, FOREIGN KEY REFERENCES GovtServants(servants_id))
29. Booking
o booking_id (INT, PRIMARY KEY, AUTO_INCREMENT)
o pnr_no (INT, UNIQUE, NOT NULL)
o passenger_id (INT, NOT NULL, FOREIGN KEY REFERENCES
Passenger(passenger_id))
o user_id (INT, NOT NULL)
o seat_id (INT, NULL, FOREIGN KEY REFERENCES Seat(seat_id))
o sleeper_id (INT, NULL, FOREIGN KEY REFERENCES Sleeper(sleeper_id))
o sleeperin_id (INT, NULL, FOREIGN KEY REFERENCES
SleeperinCabin(sleeper_id))
o cabin_id (INT, NULL)
o schedule_id (INT, NOT NULL, FOREIGN KEY REFERENCES
Schedule(schedule_id))
o booking_date (DATE, NOT NULL)
o CHECK ((seat_id IS NOT NULL AND sleeper_id IS NULL AND sleeperin_id IS
NULL) OR (seat_id IS NULL AND sleeper_id IS NOT NULL AND sleeperin_id IS
NULL) OR (seat_id IS NULL AND sleeper_id IS NULL AND sleeperin_id IS NOT
NULL))
30. FullJourney
o booking_id (INT, FOREIGN KEY REFERENCES Booking(booking_id))
o schedule_id (INT, FOREIGN KEY REFERENCES Schedule(schedule_id))
o booking_date (DATE)
31. Fare
o train_type (VARCHAR(50))
o compartment_type (VARCHAR(50))
o seat_type (VARCHAR(50))
o fare (DECIMAL(10, 2))
o created_at (TIMESTAMP, DEFAULT CURRENT_TIMESTAMP)
32. TrainDelay
o delay_id (INT, PRIMARY KEY, AUTO_INCREMENT)
o train_id (INT, FOREIGN KEY REFERENCES Train(train_id))
o station_id (INT, FOREIGN KEY REFERENCES Station(station_id))
o delay_date (TIMESTAMP, DEFAULT CURRENT_TIMESTAMP)
o delay_duration (INT)
o reason (VARCHAR(255))
33. Payment
o payment_id (INT, PRIMARY KEY, AUTO_INCREMENT)
o booking_id (INT, FOREIGN
Here is the project structure with a brief explanation of the key files and directories:

Project Structure

Directory Layout:
Important Files and Directories:
 Connection/: Contains the ConnectDB.java file, which is responsible for
connecting to the database.
 Controller/: Contains Java classes that handle different aspects of the
application, such as adding schedules, booking tickets, and getting employee
details.
 DAO/: Data Access Objects for interacting with the database. Each DAO class is
responsible for a specific entity (e.g., Booking, Employee, GovtServants, etc.).
 Models/: Contains Java classes representing the entities like Train, Station,
Passenger, etc.
 View/: Contains Java classes that handle the user interface, such as displaying
data.
 .classpath and .project: Configuration files for the Eclipse IDE.

You might also like