- A simple Java-Based Expense Tracker application that allows users to add, view, and manage their daily expenses. The project uses file handling to store data and features a clean menu-driven interface.
-
Features
-
- Add income with description and amount.
-
- Add expense with description and amount.
-
- Automatically calculate total income, total expense, and current balance.
-
- Enforces a 30% savings rule using a spending limit based on total income.
-
- Prevents spending if it would make the balance negative or cross the savings limit.
-
- Saves data (income, expense, balance) to a local file and loads it on the next run.
-
Tech Stack
-
- Language: Java
- Type: Console/CLI application
- Storage: Local text file (data.txt) for persistence.
-
Project Structure
-
- Main.java – Entry point; shows the menu and handles user input via Scanner.
-
- ExpenseTracker.java – Core logic for adding income/expense, showing summary, savings info, and saving/loading data.
-
- Savings.java – Manages balance and 30% spending limit checks.
-
- Income.java – Simple model class for income entries.
-
- Expense.java – Simple model class for expense entries.
-
How to Run
-
- Make sure you have Java (JDK 8+) installed.
-
- Place all .java files in the same package/directory (for example, expenseapp/).
-
- Compile the files: javac expenseapp/*.java
-
Run the app: java expenseapp.Main
Use the menu in the terminal: Option 1: Add Income Option 2: Add Expense Option 3: View Summary (total income, total expense, balance) Option 4: View Savings Info (current balance and 30% spending limit) Option 5: Save data and exit
Data Persistence
-
The app saves data to data.txt in the working directory when you exit using option 5.
-
On startup, it tries to load previous income, expense, and balance data; if not found, it starts fresh.
Future Improvements
-
Add support for listing all individual income and expense entries.
-
Add categories for expenses (food, travel, rent, etc.).
-
Add date and time stamps to each transaction.
-
Improve input validation and error handling.