Skip to content
DUTTAPAARTHPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

🚴 RENTAMOTO - Bike Rental Management System

A comprehensive Java Swing desktop application for managing bike rentals, built with MySQL database integration using JDBC. This application provides a complete solution for bike rental businesses with user management, inventory tracking, rental processing, and analytics.


📋 Table of Contents


✨ Features

🔐 User Management

  • User Registration - Create new user accounts with validation
  • Secure Login - Username/password authentication
  • Role-based Access - Admin and regular user roles
  • Profile Management - Update user information

🚲 Bike Inventory Management (Admin)

  • Add Bikes - Add new bikes to inventory
  • Edit Bikes - Update bike details, rates, and maintenance status
  • Delete Bikes - Remove bikes from inventory
  • Track Availability - Real-time bike availability status
  • Maintenance Tracking - Monitor bike condition

🎫 Rental Process

  • Browse Available Bikes - View all bikes with details
  • Rent Bikes - Select bike and duration with automatic cost calculation
  • Return Bikes - Complete rentals and free up bikes
  • Rental History - Track active and past rentals

📊 Reporting & Analytics (Admin)

  • Total Rentals - Count of all completed rentals
  • Revenue Tracking - Total earnings from rentals
  • Bike Popularity - Ranking of most rented bikes
  • Real-time Statistics - Live dashboard updates

🎨 Modern UI Features

  • Gradient Backgrounds - Beautiful color schemes
  • Responsive Tables - JTable with custom styling
  • Interactive Forms - Input validation and error handling
  • Card Layout Navigation - Smooth panel switching
  • Custom Icons - Emoji-based visual indicators

💻 System Requirements

  • Java Development Kit (JDK) - Version 8 or higher
  • MySQL Server - Version 5.7 or higher
  • MySQL Connector/J (JDBC Driver) - Version 8.0 or compatible
  • Operating System - Windows, macOS, or Linux
  • RAM - Minimum 2GB recommended
  • Screen Resolution - 1024x768 or higher

🛠️ Installation & Setup

Step 1: Install Prerequisites

  1. Install Java JDK

    • Download from Oracle or use OpenJDK
    • Set JAVA_HOME environment variable
    • Verify installation: java -version
  2. Install MySQL Server

    • Download from MySQL
    • Install and configure (remember root password)
    • Start MySQL service
  3. Download MySQL Connector/J

    • Download from MySQL Connector/J
    • Extract the JAR file (e.g., mysql-connector-java-8.0.33.jar)

Step 2: Setup Database

  1. Open MySQL Command Line or MySQL Workbench

  2. Run the database script:

    mysql -u root -p < database.sql

    Or manually execute the SQL file in MySQL Workbench.

  3. Verify database creation:

    USE rentamoto;
    SHOW TABLES;

Step 3: Configure Database Connection

  1. Open src/db/DBConnection.java

  2. Update database credentials:

    private static final String URL = "jdbc:mysql://localhost:3306/rentamoto";
    private static final String USERNAME = "root";  // Your MySQL username
    private static final String PASSWORD = "";      // Your MySQL password

Step 4: Compile and Run

Option A: Using Command Line (with JDBC JAR)

  1. Navigate to project directory:

    cd "c:\Users\Hitesh\OneDrive\Desktop\New folder\Rentamoto1"
  2. Compile all Java files:

    javac -cp ".;mysql-connector-java-8.0.33.jar" -d bin src/Main.java src/db/*.java src/models/*.java src/services/*.java src/ui/*.java

    Note: On Linux/Mac, use : instead of ; in classpath

  3. Run the application:

    java -cp ".;bin;mysql-connector-java-8.0.33.jar" Main

Option B: Using an IDE (Eclipse/IntelliJ/NetBeans)

  1. Import the project into your IDE
  2. Add MySQL Connector JAR to project libraries:
    • Right-click project → Build Path → Add External JARs
    • Select the mysql-connector-java-x.x.xx.jar file
  3. Run Main.java

📁 Project Structure

Rentamoto1/
│
├── src/
│   ├── Main.java                    # Application entry point
│   │
│   ├── db/
│   │   └── DBConnection.java        # Database connection handler
│   │
│   ├── models/
│   │   ├── User.java                # User entity class
│   │   ├── Bike.java                # Bike entity class
│   │   └── Rental.java              # Rental entity class
│   │
│   ├── services/
│   │   ├── UserService.java         # User CRUD operations
│   │   ├── BikeService.java         # Bike CRUD operations
│   │   └── RentalService.java       # Rental CRUD operations
│   │
│   └── ui/
│       ├── LoginFrame.java          # Login screen
│       ├── RegisterFrame.java       # Registration screen
│       ├── Dashboard.java           # Main dashboard
│       ├── BikeListPanel.java       # View all bikes
│       ├── BikeManagementPanel.java # Admin bike management
│       ├── RentBikePanel.java       # Rent bike interface
│       ├── ReturnBikePanel.java     # Return bike interface
│       └── ReportsPanel.java        # Analytics dashboard
│
└── database.sql                     # Database schema and sample data

🚀 How to Run

  1. Ensure MySQL server is running
  2. Database 'rentamoto' is created (run database.sql)
  3. Update database credentials in DBConnection.java
  4. Add MySQL Connector JAR to classpath
  5. Compile and run Main.java

The application will:

  • Test database connection
  • Display connection status in console
  • Launch the login window

📖 Usage Guide

For Regular Users

  1. Register/Login

    • Create account or login with credentials
    • After login, access the dashboard
  2. Browse Bikes

    • Click "View Bikes" to see all available bikes
    • View bike details, rates, and availability
  3. Rent a Bike

    • Click "Rent a Bike"
    • Select bike from dropdown
    • Choose rental hours (1-24)
    • Confirm rental (cost calculated automatically)
  4. Return a Bike

    • Click "Return Bike"
    • Select active rental from table
    • Confirm return

For Admin Users

All user features plus:

  1. Manage Bikes

    • Click "Manage Bikes"
    • Add: Enter bike details and save
    • Edit: Select bike, modify details
    • Delete: Select bike and remove
  2. View Reports

    • Click "Reports"
    • View total rentals and revenue
    • Check bike popularity rankings
    • Refresh data anytime

🔑 Default Credentials

Admin Account

  • Username: admin
  • Password: admin123
  • Access: Full system access including reports and bike management

Sample User Accounts

  • Username: john_doe | Password: pass123
  • Username: jane_smith | Password: pass123
  • Username: mike_wilson | Password: pass123

🗄️ Database Schema

Users Table

CREATE TABLE users (
    id INT PRIMARY KEY AUTO_INCREMENT,
    username VARCHAR(50) UNIQUE NOT NULL,
    password VARCHAR(100) NOT NULL,
    name VARCHAR(100) NOT NULL,
    role ENUM('admin', 'user') DEFAULT 'user',
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

Bikes Table

CREATE TABLE bikes (
    id INT PRIMARY KEY AUTO_INCREMENT,
    model VARCHAR(100) NOT NULL,
    rate_per_hour DECIMAL(10, 2) NOT NULL,
    available BOOLEAN DEFAULT TRUE,
    maintenance_status ENUM('good', 'needs_service', 'under_maintenance'),
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

Rentals Table

CREATE TABLE rentals (
    id INT PRIMARY KEY AUTO_INCREMENT,
    user_id INT NOT NULL,
    bike_id INT NOT NULL,
    hours INT NOT NULL,
    total_cost DECIMAL(10, 2) NOT NULL,
    status ENUM('active', 'completed') DEFAULT 'active',
    rental_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    return_date TIMESTAMP NULL,
    FOREIGN KEY (user_id) REFERENCES users(id),
    FOREIGN KEY (bike_id) REFERENCES bikes(id)
);

🖼️ Screenshots

Login Screen

  • Modern gradient background
  • Clean authentication form
  • Registration option

Dashboard

  • Menu-based navigation
  • Welcome screen with feature cards
  • Role-based menu items

Bike List

  • JTable with bike details
  • Color-coded availability
  • Refresh functionality

Rental Panel

  • Dropdown bike selection
  • Hour spinner (1-24 hours)
  • Real-time cost calculation

Admin Reports

  • Statistics cards
  • Bike popularity table
  • Revenue tracking

🛠️ Technologies Used

  • Java SE 8+ - Core programming language
  • Java Swing - GUI framework
  • JDBC (Java Database Connectivity) - Database interaction
  • MySQL - Relational database
  • OOP Principles - Encapsulation, inheritance, modularity
  • MVC Pattern - Model-View separation

🔧 Troubleshooting

Database Connection Failed

Problem: Application shows "Database connection failed" error

Solutions:

  1. Check MySQL service is running
  2. Verify database credentials in DBConnection.java
  3. Ensure rentamoto database exists
  4. Run database.sql to create tables
  5. Check MySQL is listening on port 3306

ClassNotFoundException: com.mysql.cj.jdbc.Driver

Problem: JDBC driver not found

Solutions:

  1. Download MySQL Connector/J JAR
  2. Add JAR to project classpath
  3. For IDE: Add as external library
  4. For command line: Include in -cp parameter

Compilation Errors

Problem: Cannot find symbol errors

Solutions:

  1. Ensure all source files are in correct packages
  2. Compile from root directory
  3. Use correct package structure
  4. Check Java version compatibility

UI Not Displaying Correctly

Problem: Buttons or text appear cut off

Solutions:

  1. Update Java to latest version
  2. Try different Look and Feel in Main.java
  3. Increase screen resolution
  4. Check DPI scaling settings

No Data Showing in Tables

Problem: Tables are empty after database setup

Solutions:

  1. Verify database.sql ran successfully
  2. Check sample data was inserted
  3. Refresh table using refresh button
  4. Check database connection

📝 Additional Notes

Security Considerations

  • Passwords are stored in plain text (for demonstration)
  • In production, use password hashing (BCrypt, SHA-256)
  • Implement SQL injection prevention with PreparedStatements (already done)

Future Enhancements

  • Password encryption
  • Email notifications
  • Payment gateway integration
  • Booking system with date/time
  • User profile pictures
  • Advanced search and filters
  • Export reports to PDF/Excel
  • Mobile app integration

Code Quality

  • Modular design - Separated concerns (MVC-like)
  • Reusable components - Service classes for CRUD
  • Exception handling - Try-catch blocks throughout
  • Input validation - Form validation and error messages
  • Documentation - JavaDoc comments for classes/methods

👨‍💻 Development

Adding New Features

  1. New Model: Create in models/ package
  2. Database Operations: Create service in services/
  3. UI Component: Create panel in ui/
  4. Integration: Add to Dashboard menu

Modifying Database

  1. Update database.sql
  2. Modify corresponding model class
  3. Update service methods
  4. Refresh UI components

📄 License

This project is created for educational purposes. Free to use and modify.


🤝 Support

For issues or questions:

  1. Check troubleshooting section
  2. Review code comments
  3. Verify database setup
  4. Check console output for errors

✅ Checklist Before Running

  • Java JDK installed and configured
  • MySQL Server installed and running
  • MySQL Connector/J JAR downloaded
  • Database created using database.sql
  • Database credentials updated in DBConnection.java
  • MySQL Connector JAR added to classpath
  • All Java files compiled without errors
  • Application runs and shows login screen

Happy Renting! 🚴‍♂️🚴‍♀️


RENTAMOTO - Making Bike Rentals Simple and Efficient

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages