Skip to content

A simple Java program which is connected to the database via JDBC and illustrates all core fundamentals of Java OOP.

Notifications You must be signed in to change notification settings

YashasJKumar/Journey_Assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Journey Assistant

Journey Assistant is a Java application that helps users manage and plan their travel using different types of vehicles. It provides functionality to insert, delete, update, and view journey data stored in a MySQL database.

image

A simple Java program which is connected to the database via JDBC and illustrates all core fundamentals of Java OOP.

Table of Contents

Features

  • Insert journey data for cars and bikes
  • Delete the last record from the database
  • Update vehicle names in the database
  • View all journey records in the database
  • Calculate fuel quantity required for a journey
  • Calculate fuel price based on fuel type and quantity
  • Handle exceptions for invalid seat numbers

Prerequisites

Before you begin, ensure you have met the following requirements:

  • Java Development Kit (JDK) 8 or higher
  • MySQL Server
  • MySQL Connector/J (JDBC driver for MySQL)

Installation

  1. Clone the repository:

    git clone https://github.com/your-username/journey-assistant.git
    cd journey-assistant
  2. Set up the MySQL database:

    • Create a new database
    • Update the database connection details in the Main.java file:
      String url = "jdbc:mysql://localhost:3306/your-database-name";
      String uname = "your_username";
      String password = "your_password";
  3. Compile the Java files:

    javac Project/*.java

Usage

To run the Journey Assistant application:

  1. Navigate to the project directory
  2. Run the main class:
    java Project.Main
  3. Follow the on-screen prompts to interact with the application

Database Schema

The application uses a table named Journey with the following structure:

  • SL_No (INT): Serial number (Primary Key)
  • Name (VARCHAR): Vehicle name
  • Type (VARCHAR): Vehicle type (Car or Bike)
  • Manufacturer (VARCHAR): Vehicle manufacturer
  • Fuel_Type (VARCHAR): Type of fuel used
  • Mileage (FLOAT): Vehicle mileage
  • Distance (FLOAT): Travel distance
  • Fuel_Required (FLOAT): Quantity of fuel required
  • Price (FLOAT): Total fuel price for the journey

Classes

  • Main: The main class that handles user interaction and database operations
  • Automobile: Base class for vehicles
  • Car: Subclass of Automobile for car-specific operations
  • Bike: Subclass of Automobile for bike-specific operations

Exception Handling

The application includes a custom exception Invalid_seat to handle cases where the number of persons exceeds the available seats in the vehicle.

Contributing

Contributions to the Journey Assistant project are welcome. Please ensure that your code adheres to the project's coding standards and includes appropriate error handling.

About

A simple Java program which is connected to the database via JDBC and illustrates all core fundamentals of Java OOP.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages