A Java console-based application to manage bus schedules and passenger records with persistent storage using MySQL.
- Add, list, search, and delete buses.
- Book, list, search, and delete passengers.
- View available buses.
- Input validation for user inputs.
- Persistent data storage using JDBC.
- Modular and maintainable design using OOP Principles.
- Java
- MySQL
- JDBC (Java Database Connectivity)
- Object-Oriented Programming (OOP)
├── model │ ├── Bus.java │ └── Passenger.java ├── service │ ├── BusService.java │ └── PassengerService.java ├── util │ └── InputHelper.java └── Main.java
CREATE TABLE bus (
busNo INT PRIMARY KEY,
scheduleDate DATE NOT NULL,
capacity INT NOT NULL,
isAvailable TINYINT(1) DEFAULT 1,
startingPoint VARCHAR(100),
destinationPoint VARCHAR(100)
);
CREATE TABLE passenger (
passId INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(100) NOT NULL,
age INT NOT NULL,
gender VARCHAR(10),
contactNumber VARCHAR(15),
dateBooked DATE NOT NULL,
amountPaid DECIMAL(10,2) NOT NULL,
boardingPoint VARCHAR(100) NOT NULL,
destinationPoint VARCHAR(100) NOT NULL,
busNo INT,
FOREIGN KEY (busNo) REFERENCES bus(busNo)
);
Set up a MySQL database and create the above tables.
Update JDBC connection details (URL, username, password) in your Java code if required.
Compile and run Main.java through any Java IDE (like IntelliJ, Eclipse) or using the command line.
Interact with the console-based menu to use features.