A comprehensive Java-based bus reservation system that provides both console and GUI interfaces for managing bus bookings, user accounts, and administrative functions.
- User Registration & Authentication: Secure user registration and login system
- Bus Search & Booking: View available buses and book tickets
- Seat Selection: Interactive seat selection with real-time availability
- Booking Management: View, update, and cancel bookings
- Profile Management: Update user profile information
- Bus Management: Add, update, and delete buses
- Route Management: Manage bus routes and schedules
- Booking Monitoring: View all bookings and system statistics
- User Management: Create admin users and manage user accounts
- Seat Layout Management: Monitor and manage seat availability
- Database Integration: SQLite database for data persistence
- Dual Interface: Both console and GUI interfaces available
- Real-time Updates: Live seat availability and booking status
- Fare Calculation: Dynamic fare calculation based on bus type and route
- Data Validation: Comprehensive input validation and error handling
- Java 11+: Core programming language
- SQLite: Database for data persistence
- Swing: GUI framework for desktop application
- Maven: Build and dependency management
- JUnit 5: Unit testing framework
- Mockito: Mocking framework for testing
src/
├── main/
│ └── java/
│ └── com/
│ └── busreservation/
│ ├── Main.java # Application entry point
│ ├── model/ # Data models
│ │ ├── User.java
│ │ ├── Bus.java
│ │ ├── Seat.java
│ │ ├── Route.java
│ │ ├── Schedule.java
│ │ └── Booking.java
│ ├── database/
│ │ └── DatabaseManager.java # Database connection and setup
│ ├── dao/ # Data Access Objects
│ │ ├── UserDAO.java
│ │ ├── BusDAO.java
│ │ └── BookingDAO.java
│ ├── service/ # Business logic layer
│ │ ├── AuthenticationService.java
│ │ ├── BusService.java
│ │ └── BookingService.java
│ ├── console/ # Console interface
│ │ └── ConsoleUI.java
│ └── gui/ # GUI interface
│ └── BusReservationGUI.java
└── test/
└── java/
└── com/
└── busreservation/
└── service/
└── AuthenticationServiceTest.java
- Java 11 or higher
- Maven 3.6 or higher
-
Clone or download the project
git clone <repository-url> cd bus-reservation-system
-
Build the project using Maven
mvn clean compile
-
Run tests
mvn test -
Package the application
mvn package
-
Run with Maven
mvn exec:java -Dexec.mainClass="com.busreservation.Main" -
Run the JAR file
java -jar target/bus-reservation-system-1.0.0.jar
-
Choose Interface Type
- Select
1for Console Interface - Select
2for GUI Interface
- Select
- Start the application and choose Console Interface
- Register a new account or login with existing credentials
- View available buses and their details
- Book tickets by selecting a bus and seat
- Manage bookings - view, update, or cancel reservations
- Admin functions (if logged in as admin):
- Add/update/delete buses
- View all bookings
- Create admin users
- Start the application and choose GUI Interface
- Login/Register using the graphical interface
- Browse buses in the table view
- Book tickets by selecting a bus and seat
- Manage bookings through the dedicated panel
- Admin panel provides additional management features
The system uses SQLite database with the following tables:
- users: User accounts and authentication
- buses: Bus information and capacity
- routes: Route details and fare multipliers
- schedules: Bus schedules and timings
- bookings: Reservation records
- seats: Individual seat status tracking
The application comes with pre-loaded sample data including:
- Sample bus routes (New York to Boston, Philadelphia, etc.)
- Sample buses with different types (Luxury, Standard, Economy)
- Sample schedules for different days
- Pre-configured seat layouts
- Database file:
bus_reservation.db(created automatically) - Connection string:
jdbc:sqlite:bus_reservation.db
- Username:
admin - Password:
admin123 - Email:
admin@busreservation.com
Run the test suite using Maven:
mvn testThe test suite includes:
- Unit tests for service classes
- Mock-based testing for data access layers
- Integration tests for core functionality
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Payment gateway integration
- Email notifications
- Mobile app interface
- Advanced reporting and analytics
- Multi-language support
- Real-time seat updates via WebSocket
- Integration with external booking systems
For support and questions, please contact the development team or create an issue in the repository.
- Initial release
- Console and GUI interfaces
- Complete CRUD operations for buses and bookings
- User authentication and authorization
- SQLite database integration
- Comprehensive test suite