Skip to content

lakshaybxt/jdbc-bus-agency

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bus Travelling Agency 🚍

A Java console-based application to manage bus schedules and passenger records with persistent storage using MySQL.

Made with Java Database MySQL Status


✨ Features

  • 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.

🛠️ Tech Stack

  • Java
  • MySQL
  • JDBC (Java Database Connectivity)
  • Object-Oriented Programming (OOP)

📂 Project Structure

├── model │ ├── Bus.java │ └── Passenger.java ├── service │ ├── BusService.java │ └── PassengerService.java ├── util │ └── InputHelper.java └── Main.java


🗄️ Database Schema

bus Table

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

passenger Table

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

📋How to Run

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages