Expense Tracker App

“A tool to monitor daily expenses, manage budgets, and achieve savings goals.”

The Expense Tracker App is designed to help individuals manage their budgets and track expenses effectively. It provides an intuitive interface for logging expenses, updating income, and setting savings goals.

This project addresses users’ challenges when manually tracking expenses and maintaining a balanced budget.

Problem Statement

What Problem Does It Solve?
Many individuals struggle to monitor their spending and stay within budget, which can lead to financial instability.

How Does It Solve It?
The Expense Tracker App allows users to log expenses, calculate their remaining budget, and track progress toward their savings goals.

Key Features

  1. Expense Logging
    • Users can add expenses by specifying the item name and cost.
    • Automatically deducts the expense from the remaining budget.
  2. Income Updates
    • Allows users to update their income and recalculate their budget.
  3. Savings Goal Management
    • Users can set or adjust their savings goals.
    • Tracks progress toward achieving savings.
  4. Expense History
    • Displays all logged expenses with a summary of total spending.

Workflow or User Scenarios

Scenario 1:

  • The user buys fuel for $60.
  • Logs the expense as “fuel” with the cost of $60.
  • The app subtracts $60 from the budget and displays the remaining balance and savings goal.

Scenario 2:

  • The user logs another fuel expense of $60.
  • The total spent on fuel is updated to $120.
  • The user views all previous expense inputs, which display the total fuel expenses.

Scenario 3:

  • The user adds $6000 to their budget.
  • The remaining budget will be updated to $ 8,000 while retaining the current savings goal.

Scenario 4:

The app updates the savings goal to $3300 and recalculates the remaining budget.

The user increases their savings goal by $3000.

Code Implementation

The code for the Expense Tracker App is written in Python and focuses on handling user inputs, managing financial data, and presenting budget insights.

  • Initializing User Data:
user_name = input("Enter your name: ")
total_income = float(input("Enter your total income: "))
savings_goal = float(input("Enter your savings goal: "))
expenses = {}  # Dictionary to store expense history
remaining_budget = total_income - savings_goal
  • Menu System:
while True:
    print("\nMenu:")
    print("1. Add expense")
    print("2. Add income")
    print("3. Add additional savings input")
    print("4. View all previous expense inputs")
    print("5. Exit")
    choice = int(input("Enter your choice: "))
  • Logging Expenses:
if choice == 1:
    expense_name = input("Enter the expense name: ")
    expense_cost = float(input("Enter the expense amount: "))
    remaining_budget -= expense_cost
    expenses[expense_name] = expenses.get(expense_name, 0) + expense_cost
    print(f"Remaining budget: ${remaining_budget}")

Challenges and Learnings

  • Learnings: Improved skills in dictionary manipulation, input validation, and Python’s conditional logic.
  • Challenges: Managing user inputs and calculating real-time updates for both budgets and savings goals.

Future Improvements

  • Implement detailed financial reports with charts and graphs.
  • Add persistent storage for user data (e.g., using a database or files).
  • Introduce a graphical user interface (GUI) for better usability.

Conclusion

The Expense Tracker App provides an easy-to-use solution for managing budgets and tracking expenses, enabling users to achieve their financial goals efficiently.

Below is the source code:

# Welcome message
print("Welcome to the Budget Tracker App!")

# Get user's name
user_name = input("Please enter your name: ")

# Get user's total income
total_income = float(input("Please enter your total income: "))

# Dictionary to store previous expenses
expenses = {}

# Get savings goal
savings_goal = float(input("What is your total savings goal? "))

# Calculate remaining balance for expenses
remaining_balance = total_income - savings_goal

# Calculate remaining savings goal
remaining_savings_goal = savings_goal

# Menu
while True:

  # Display menu options
  print(f"Your remaining balance for expenses is: {remaining_balance}")
  print(f"Your remaining savings is: {remaining_savings_goal}")
  print("\nMenu:")
  print("1. Add expense")
  print("2. Add income")
  print("3. Add additional savings input")
  print("4. View all previous expense inputs")

  choice = input("Enter your choice: ")

  # Add expense
  if choice == "1":
    expense_item = input("Enter the item of the expense: ")

    # Validate input
    try:
      expense = float(input("Enter the amount of the expense: "))
    except ValueError:
      print("Invalid input. Please enter a valid number.")
      continue

    # Add expense to dictionary
    if expense_item in expenses:
      expenses[expense_item] += expense
    else:
      expenses[expense_item] = expense
    remaining_balance -= expense

    # Ensure remaining balance doesn't go negative
    if remaining_balance < 0:
        # Calculate the amount exceeded the budget
        exceeded_amount = abs(remaining_balance)
        # Reduce the remaining savings goal
        remaining_savings_goal -= exceeded_amount
        # Alert the user
        print(f"WARNING: You have exceeded your budget by {exceeded_amount} and dipped into your savings.")

  # Add income
  elif choice == "2":
    income = float(input("Enter the amount of the income: "))
    total_income += income
    remaining_balance += income

  # Add additional savings input
  elif choice == "3":
      additional_savings = float(input("Enter the additional amount for savings: "))
      savings_goal += additional_savings
      remaining_savings_goal += additional_savings

  # View all previous expense inputs
  elif choice == "4":
    print("Previous expense inputs:")
    for item, amount in expenses.items():
      print(f"{item}: {amount}")

  # Invalid choice
  else:
    print("Invalid choice. Please try again.")