A Java desktop application for managing penalties and fines — with both GUI (Swing) and Terminal (CLI) interfaces. Built using layered architecture with MySQL as the database.
| Role | Capabilities |
|---|---|
| Admin | System report, view all fines, pending fines, overdue fines, total fine per user, lookup user total fine, search fines, audit log, search history, view all users |
| Authority | Issue fines/penalties to users, view fines issued by authority, view all users, view violation types, search fines, system report |
| User | View profile, view fines, pending fines, total fine, pay fines, search fines, search history |
- User Signup & Login — Register new accounts, login with email/password
- Fine Issuance — Authority can issue fines with violation type, location, amount, due date, and daily penalty
- Fine Payment — Users can pay fines via UPI, Card, NetBanking, or Cash
- Search — Search fines by violation name, location, or user name (logged in SearchRequest table)
- Audit Log — All payments, fine issuances, and signups are auto-tracked by database triggers
- Dual Interface — Full feature parity between GUI and Terminal modes
- 6 Triggers — Auto-update fine status on payment, update total fine, track fine history, audit logging for payments/fines/signups
- 3 Views — PendingFines, TotalFinePerUser, OverdueFines
- 1 Stored Procedure — GetUserTotalFine
- Indexes — On email, fine status, due date
- CHECK constraints, ENUM types, Foreign Keys, CASCADE deletes
| Component | Technology |
|---|---|
| Language | Java 8+ |
| GUI | Java Swing (Nimbus L&F) |
| Database | MySQL |
| Connectivity | JDBC (MySQL Connector/J) |
| Architecture | Layered (Model → DAO → Service → Controller → GUI/CLI) |
PFAMS/
├── pfams_setup.sql # Database setup script (tables, data, triggers, views, procedure)
├── run.bat # Build & run script (Windows)
├── lib/
│ └── mysql-connector-j-9.6.0.jar # MySQL JDBC driver
├── src/
│ ├── model/ # Entity classes (User, Account, Fine, Violation, etc.)
│ ├── util/ # Database connection utility (DBConnection.java)
│ ├── dao/ # Data Access Objects (SQL queries)
│ ├── service/ # Business logic layer
│ ├── controller/ # Controllers (bridge between UI and service)
│ ├── gui/ # Swing GUI screens
│ └── main/ # Entry point (Main.java, TerminalApp.java)
└── out/ # Compiled .class files (auto-generated)
Before running the application, you MUST configure your database connection and set up the MySQL database. Follow these steps carefully:
git clone https://github.com/Krish-Korat/PFAMS.git
cd PFAMS- Open MySQL terminal or MySQL Workbench
- Run the setup script:
source /path/to/PFAMS/pfams_setup.sql;This creates the
PFAMSdatabase with all tables, sample data, triggers, views, and stored procedure.
Open src/util/DBConnection.java and update the credentials to match your local MySQL configuration:
private static final String URL = "jdbc:mysql://localhost:3306/<YOUR_DATABASE_NAME>"; // Usually PFAMS
private static final String USER = "<YOUR_MYSQL_USERNAME>"; // Usually root
private static final String PASSWORD = "<YOUR_MYSQL_PASSWORD>"; // Change this to your passwordYou can use the provided batch script to run the application automatically on Windows, or compile the Java source files manually.
Windows (Automated):
You can simply double-click the run.bat file in the project root directory, or run it from the command line:
run.batWindows (Manual):
# 1. Create the output directory (if it doesn't exist)
mkdir out
# 2. Compile all source files into the out directory
javac -d out -cp "lib\mysql-connector-j-9.6.0.jar" src\model\*.java src\util\*.java src\dao\*.java src\service\*.java src\controller\*.java src\gui\*.java src\main\*.java
# 3. Run the application
java -cp "out;lib\mysql-connector-j-9.6.0.jar" main.MainLinux / macOS:
# 1. Create the output directory
mkdir out
# 2. Compile all source files
javac -d out -cp "lib/mysql-connector-j-9.6.0.jar" src/model/*.java src/util/*.java src/dao/*.java src/service/*.java src/controller/*.java src/gui/*.java src/main/*.java
# 3. Run the application (Note the colon ':' instead of semicolon ';')
java -cp "out:lib/mysql-connector-j-9.6.0.jar" main.Main==========================================
PFAMS - Penalty/Fine Management System
==========================================
Select mode:
1. GUI Mode (Graphical Interface)
2. Terminal Mode (CLI)
3. Exit
==========================================
| Role | Password | |
|---|---|---|
| Admin | admin@pfams.com |
admin |
| Authority | officer@pfams.com |
officer |
| User | rahul@gmail.com |
pass1 |
| User | amit@gmail.com |
pass2 |
| User | sneha@gmail.com |
pass3 |
| ... | ... | pass4 to pass10 |
Users (1) ──── (1) Account ──── (1) Role
│
┌──────────┼──────────┐
▼ ▼ ▼
SearchRequest Violation (TotalFine)
│
▼
Fine ──── Authority
│
┌─────┼─────┐
▼ ▼ ▼
Penalty Payment FineHistory
│
▼
AuditLog (via triggers)
- Role — Admin, User, Authority
- Users — User personal information
- Account — Login credentials, role, total fine
- SearchRequest — Logged searches
- ViolationType — Types of violations with base fines
- Violation — Violation records linked to accounts
- Authority — Issuing authorities
- Fine — Fine records with status (Paid/Unpaid)
- Penalty — Daily penalty for overdue fines
- Payment — Payment records
- AuditLog — System activity trail (auto-populated by triggers)
- FineHistory — Tracks fine amount changes
This project is for educational purposes.