Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ATM System - Java Swing + MySQL

A complete ATM Management System built with Java OOP, Swing GUI, and MySQL database. This is a production-ready desktop application suitable for ATM operations.


🎯 Features

βœ… User Authentication

  • User signup with validation
  • Secure PIN-based login
  • Email uniqueness validation

βœ… Banking Operations

  • Deposit money
  • Withdraw money (with balance validation)
  • Check account balance
  • Transaction history (last 10 transactions)

βœ… Database Management

  • Persistent data storage in MySQL
  • Transaction logging
  • User account management

βœ… UI/UX

  • Clean, professional Swing interface
  • Designed for laptop screens (900x600)
  • Color-coded operations
  • Easy navigation between screens

πŸ“‹ Tech Stack

  • Language: Java (OOP)
  • GUI Framework: Swing
  • Database: MySQL
  • JDBC Driver: MySQL Connector/J (v8.0+)

πŸ“ Project Structure

ATM-System/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main/
β”‚   β”‚   └── Main.java
β”‚   β”œβ”€β”€ ui/
β”‚   β”‚   β”œβ”€β”€ LoginFrame.java
β”‚   β”‚   β”œβ”€β”€ SignupFrame.java
β”‚   β”‚   β”œβ”€β”€ DashboardFrame.java
β”‚   β”‚   β”œβ”€β”€ DepositFrame.java
β”‚   β”‚   └── WithdrawFrame.java
β”‚   β”œβ”€β”€ model/
β”‚   β”‚   β”œβ”€β”€ User.java
β”‚   β”‚   └── Account.java
β”‚   β”œβ”€β”€ dao/
β”‚   β”‚   β”œβ”€β”€ DBConnection.java
β”‚   β”‚   β”œβ”€β”€ UserDAO.java
β”‚   β”‚   β”œβ”€β”€ AccountDAO.java
β”‚   β”‚   └── TransactionDAO.java
β”‚   └── services/
β”‚       β”œβ”€β”€ AuthService.java
β”‚       β”œβ”€β”€ TransactionService.java
β”‚       └── Validator.java
β”œβ”€β”€ sql/
β”‚   └── schema.sql
└── README.md

πŸš€ Setup Instructions

Step 1: Install MySQL

  1. Download and install MySQL from mysql.com
  2. Start the MySQL server
  3. Ensure MySQL is running on localhost:3306

Step 2: Create Database

  1. Open MySQL Workbench or MySQL Command Line
  2. Run the SQL script to create the database:
mysql -u root -p < schema.sql

Or paste the contents of schema.sql file in MySQL Workbench.

Output:

Database "atm_system" created successfully
Tables created: users, accounts, transactions

Step 3: Download MySQL JDBC Driver

  1. Download MySQL Connector/J from: https://dev.mysql.com/downloads/connector/j/

  2. Or install via Maven:

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>8.0.33</version>
</dependency>

Step 4: Configure Database Connection

Edit dao/DBConnection.java and set your MySQL credentials:

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

Step 5: Compile the Project

Using Command Line:

  1. Copy all Java files to a folder
  2. Ensure MySQL JDBC driver is in classpath:
javac -cp mysql-connector-java-8.0.33.jar src/**/*.java -d bin/

Using IDE (IntelliJ/Eclipse):

  1. Create a new Java project
  2. Add project structure (src/main, src/ui, etc.)
  3. Add MySQL JDBC JAR to project libraries
  4. Build the project

Step 6: Run the Application

java -cp bin:mysql-connector-java-8.0.33.jar main.Main

Or run directly from IDE by running Main.java


πŸ” Default Test Account

After running schema.sql, you can use this test account:

Email: test@example.com PIN: 1234 Balance: 1000

To add this test account, uncomment the sample data in schema.sql:

INSERT INTO users (name, email, pin) VALUES ('Test User', 'test@example.com', '1234');
INSERT INTO accounts (user_id, balance) VALUES (1, 1000.00);

πŸ’‘ Usage Guide

Login Screen

  1. Enter your email and PIN
  2. Click "Login" to access your account
  3. New users click "Sign Up"

Sign Up Screen

  1. Enter full name (minimum 3 characters)
  2. Enter email (valid format)
  3. Enter PIN (4-10 digits)
  4. Confirm PIN
  5. Click "Sign Up"

Dashboard

After login, you can:

  • Deposit Money - Add funds to your account
  • Withdraw Money - Withdraw funds (if balance sufficient)
  • Check Balance - View current balance
  • Transaction History - See last 10 transactions
  • Logout - Exit the application

βš™οΈ Troubleshooting

Issue: "Connection refused" or "Cannot connect to database"

Solution:

  • Ensure MySQL server is running
  • Check if port 3306 is accessible
  • Verify credentials in DBConnection.java
  • Run mysql -u root -p to test connection

Issue: "MySQL JDBC Driver not found"

Solution:

  • Add mysql-connector-java-8.0.33.jar to your classpath
  • In IDE, add JAR to project libraries
  • Ensure JAR is in the same folder when running from command line

Issue: "Table doesn't exist"

Solution:

  • Run schema.sql again
  • Verify database "atm_system" was created
  • Check MySQL user has proper permissions

Issue: "Access Denied for user 'root'@'localhost'"

Solution:

  • Update password in DBConnection.java
  • Or reset MySQL root password
  • Check MySQL is using default port 3306

πŸ“Š Database Schema

Users Table

id          INT (Primary Key, Auto-increment)
name        VARCHAR(100)
email       VARCHAR(100) (Unique)
pin         VARCHAR(10)
created_at  TIMESTAMP

Accounts Table

id          INT (Primary Key, Auto-increment)
user_id     INT (Foreign Key)
balance     DOUBLE
created_at  TIMESTAMP

Transactions Table

id          INT (Primary Key, Auto-increment)
user_id     INT (Foreign Key)
type        VARCHAR(20) - DEPOSIT or WITHDRAW
amount      DOUBLE
date        TIMESTAMP

πŸ”’ Security Features

βœ… PIN validation (4-10 numeric digits) βœ… Email format validation βœ… Secure user input handling βœ… PreparedStatement (prevents SQL injection) βœ… Balance verification before withdrawal βœ… Prevents negative deposits/withdrawals βœ… Transaction logging for audit trail


🎨 UI Details

Color Scheme:

  • Login Frame: Blue (#2980B9)
  • Signup Frame: Purple (#9B59B6)
  • Dashboard: Light Blue (#3498DB)
  • Deposit: Green (#2ECC71)
  • Withdraw: Red (#E74C3C)

Screen Size: 900 x 600 (Laptop friendly) Font: Arial (14-36pt depending on use)


πŸ“ Example Test Cases

Test Case 1: New User Signup

  1. Click "Sign Up" on Login screen
  2. Enter: Name="John Doe", Email="john@test.com", PIN="5678"
  3. Confirm PIN="5678"
  4. Click "Sign Up"
  5. βœ… Account created successfully

Test Case 2: Deposit Money

  1. Login with valid credentials
  2. Click "Deposit Money"
  3. Enter amount="1000"
  4. Click "Deposit"
  5. βœ… Balance increases by 1000

Test Case 3: Withdraw Money

  1. Dashboard shows balance
  2. Click "Withdraw Money"
  3. Enter amount="500"
  4. Click "Withdraw"
  5. βœ… Balance decreases by 500

Test Case 4: Check Balance After Transactions

  1. Click "Check Balance"
  2. βœ… Shows updated balance
  3. Click "Transaction History"
  4. βœ… Shows DEPOSIT and WITHDRAW records

🀝 Contributing

This project is suitable for:

  • Learning Java Swing GUI development
  • Understanding OOP principles
  • Practicing database design with JDBC
  • Portfolio project showcase

Feel free to extend with:

  • Transfer between accounts
  • Mini statement printing
  • PIN change functionality
  • Account freeze/deactivate
  • Mobile app version

πŸ“„ License

This project is open-source and free to use for educational and personal purposes.


πŸ‘¨β€πŸ’» Author

Created as a complete ATM Management System for learning Java, Swing, and MySQL integration.


πŸ“ž Support

For issues or questions:

  1. Check the Troubleshooting section
  2. Verify database setup
  3. Ensure MySQL JDBC driver is properly installed
  4. Check Java version (requires Java 8+)

πŸŽ“ Learning Outcomes

This project teaches:

  • OOP Concepts: Inheritance, Encapsulation, Polymorphism
  • Design Patterns: DAO, Service Layer, MVC
  • Database Operations: CRUD operations, Foreign Keys, Indexes
  • GUI Development: Swing, Event Handling, Layout Management
  • Best Practices: Input Validation, Error Handling, Code Organization

Enjoy building! πŸš€

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages