Mini Project Report
on
EXPENSE TRACKER
Datta Meghe College of Engineering, Airoli
Sr.No. Name Roll No.
1. SHRAVAN SHAILESH BHATKAR 09
2. SAKSHI SUBHASH BHOIR 11
3. VIDHAN VIKAS CHAVAN 15
4. ARYA MAHESH DALVI 17
Mrs.Vrushali Dharmale
(Practical guide)
2024-2025
Department of Artificial Intelligence and Data Science Engineering
Datta Meghe College of Engineering
(Affiliated to the University of Mumbai)
Aim:-
The aim of this project is to develop a command-line based expense
tracker in Java that enables users to efficiently record, categorize, and
analyze their expenses. By providing a simple interface for users to
input and manage their financial data, the project seeks to foster better
financial awareness and control over spending habits.
Introduction:-
In today’s fast-paced world, effective financial management is vital,
yet many struggle to accurately track their spending. This project
develops a simple expense tracker using Java to address this issue.
The application features a command-line interface that allows users to
log expenses, categorize them, and analyze spending trends. By
leveraging Java’s capabilities, the project underscores the importance
of coding and demonstrates how programming can provide practical
solutions for everyday challenges. This report details the development
process, features, and potential enhancements of the expense tracker,
highlighting its role in promoting financial awareness and responsible
spending habits.
Software Used:-
Java Development Kit (JDK), Notepad and Command Prompt.
Implementation:-
class Expense {
private String category;
private double amount;
private String date; // Format: DD-MM-YYYY
public Expense(String category, double amount, String date) {
this.category = category;
this.amount = amount;
this.date = date;
}
public String getCategory() {
return category;
}
public double getAmount() {
return amount;
}
public String getDate() {
return date;
}
}
public class ExpenseManager {
private List<Expense> expenses = new ArrayList<>();
private Scanner scanner = new Scanner(System.in);
public void addExpense() {
System.out.print("Enter category: ");
String category = scanner.nextLine();
System.out.print("Enter amount: ");
double amount = Double.parseDouble(scanner.nextLine());
System.out.print("Enter date (DD-MM-YYYY): ");
String date = scanner.nextLine();
expenses.add(new Expense(category, amount, date));
System.out.println("Expense added!");
}
public void viewExpenses() {
if (expenses.isEmpty()) {
System.out.println("No expenses to display.");
} else {
System.out.printf("%-20s %-10s %-10s%n", "Category", "Amount",
"Date");
System.out.println("----------------------------------------------");
for (Expense expense : expenses) {
System.out.printf("%-20s Rs%-9.2f %-10s%n",
expense.getCategory(),
expense.getAmount(),
expense.getDate());
}
}
}
public double calculateTotal() {
double total = 0;
for (Expense expense : expenses) {
total += expense.getAmount();
}
return total;
}
public void saveToFile() {
// Implement file saving logic here
}
public void loadFromFile() {
// Implement file loading logic here
}
}
public class ExpenseTracker {
public static void main(String[] args) {
ExpenseManager manager = new ExpenseManager();
Scanner scanner = new Scanner(System.in);
String command;
do {
System.out.println("Enter a command (add/view/total/exit): ");
command = scanner.nextLine();
switch (command.toLowerCase()) {
case "add":
manager.addExpense();
break;
case "view":
manager.viewExpenses();
break;
case "total":
double total = manager.calculateTotal();
System.out.printf("Total expenses: Rs%.2f%n", total);
break;
case "exit":
System.out.println("Exiting...");
break;
default:
System.out.println("Unknown command.");
}
} while (!command.equalsIgnoreCase("exit"));
scanner.close(); // Close the scanner
}
}
public class Expense {
private String category;
private double amount;
private String date;
public Expense(String category, double amount, String date) {
this.category = category;
this.amount = amount;
this.date = date;
}
public String getCategory() {
return category;
}
public double getAmount() {
return amount;
}
public String getDate() {
return date;
}
@Override
public String toString() {
return String.format("%s: $%.2f on %s", category, amount, date);
}
}
Output:-
Conclusion:-
The expense tracker project showcases the use of Java programming
for managing personal finances via a command-line interface. It
allows users to log expenses, categorize them, and generate spending
summaries. While it offers essential features, user feedback highlights
its effectiveness in tracking expenditures. Future enhancements could
include data persistence, improved user interaction, and a graphical
user interface. Overall, the project exemplifies how programming can
provide practical solutions for everyday financial management.
R1 R2 R3 R4 Total Sign
(5 marks) (5 marks) (5 marks) (5 marks) (20 marks)