0% found this document useful (0 votes)
9 views

Sathvik Oop

The document outlines a Python program for a personalized financial manager that allows users to set their monthly income, savings goals, budget categories, and expenses. It includes methods for calculating total expenses, checking the budget, and tracking progress towards savings goals. The program provides a menu-driven interface for user interaction and feedback on financial management.

Uploaded by

syedafrose890
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Sathvik Oop

The document outlines a Python program for a personalized financial manager that allows users to set their monthly income, savings goals, budget categories, and expenses. It includes methods for calculating total expenses, checking the budget, and tracking progress towards savings goals. The program provides a menu-driven interface for user interaction and feedback on financial management.

Uploaded by

syedafrose890
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

1/3/25, 11:07 AM Untitled16.

ipynb - Colab

#/usr/bin/env python
# coding: utf-8

# In[ ]:

class Financmanager:
def __init__(self):
self.income = 0
self.savings_goal = 0
self.budget = {}
self.expenses = []

def set_income(self):
try:
self.income = float(input("Enter your monthly income: "))
print(f"Monthly income set to ${self.income}\n")
except ValueError:
print("Invalid input! Please enter a valid number.")

def set_savings_goal(self):
try:
self.savings_goal = float(input("Enter your savings goal: "))
print(f"Savings goal set to ${self.savings_goal}\n")
except ValueError:
print("Invalid input! Please enter a valid number.")

def set_budget(self):
category = input("Enter budget category: ")
try:
amount = float(input(f"Enter budget amount for {category}: "))
self.budget[category] = amount
print(f"Budget set: {category} - ${amount}\n")
except ValueError:
print("Invalid input! Please enter a valid number.")

def add_expense(self):
category = input("Enter expense category: ")
try:
amount = float(input(f"Enter expense amount for {category}: "))
if category not in self.budget:
print(f"Warning: {category} is not in the budget!")
self.expenses.append((category, amount))
print(f"Expense added: {category} - ${amount}\n")
except ValueError:
print("Invalid input! Please enter a valid number.")

def calculate_expenses(self):
return sum(amount for _, amount in self.expenses)

def check_budget(self):
print("\nBudget Report:")
for category, amount in self.budget.items():
spent = sum(exp[1] for exp in self.expenses if exp[0] == category)
print(f" {category}: Budgeted ${amount}, Spent ${spent}, Remaining ${amount - spent}")
print()

def progress_towards_goal(self):
total_expenses = self.calculate_expenses()
savings = self.income - total_expenses
print(f"\nTotal expenses: ${total_expenses}")
print(f"Savings so far: ${savings}")
if savings >= self.savings_goal:
print("Congratulations! You've reached your savings goal!\n")
else:
print(f"You need ${self.savings_goal - savings} more to reach your goal.\n")

def show_menu(self):
print("\n--- Personalized Financial Manager ---")
print("1. Set Monthly Income")
print("2. Set Savings Goal")
print("3. Set Budget")
print("4. Add Expense")
print("5. Check Budget")
print("6. View Savings Progress")
print("7. Exit")
print("-----------------------------------------")

#Main
def main():
h i ()
https://colab.research.google.com/drive/1KijVuG_Ttk_bU6Ntzc0YmI7bfrEsR5io#printMode=true 1/3
1/3/25, 11:07 AM Untitled16.ipynb - Colab
coach = Financmanager()
while True:
coach.show_menu()
choice = input("Enter your choice: ")
print()
if choice == '1':
coach.set_income()
elif choice == '2':
coach.set_savings_goal()
elif choice == '3':
coach.set_budget()
elif choice == '4':
coach.add_expense()
elif choice == '5':
coach.check_budget()
elif choice == '6':
coach.progress_towards_goal()
elif choice == '7':
print("Exiting... Thank you for using Financial Coaching!")
break
else:
print("Invalid choice! Please select a valid option.\n")

if __name__ == "__main__":
main()

#In[ ]:

--- Personalized Financial Manager ---


1. Set Monthly Income
2. Set Savings Goal
3. Set Budget
4. Add Expense
5. Check Budget
6. View Savings Progress
7. Exit
-----------------------------------------
Enter your choice: 1

Enter your monthly income: 2


Monthly income set to $2.0

--- Personalized Financial Manager ---


1. Set Monthly Income
2. Set Savings Goal
3. Set Budget
4. Add Expense
5. Check Budget
6. View Savings Progress
7. Exit
-----------------------------------------
Enter your choice: 3

Enter budget category: 4


Enter budget amount for 4: 5
Budget set: 4 - $5.0

--- Personalized Financial Manager ---


1. Set Monthly Income
2. Set Savings Goal
3. Set Budget
4. Add Expense
5. Check Budget
6. View Savings Progress
7. Exit
-----------------------------------------
Enter your choice: 6

Total expenses: $0
Savings so far: $2.0
Congratulations! You've reached your savings goal!

--- Personalized Financial Manager ---

https://colab.research.google.com/drive/1KijVuG_Ttk_bU6Ntzc0YmI7bfrEsR5io#printMode=true 2/3
1/3/25, 11:07 AM Untitled16.ipynb - Colab
1. Set Monthly Income
2. Set Savings Goal
3. Set Budget
4. Add Expense
5. Check Budget
6. View Savings Progress
7. Exit
-----------------------------------------

https://colab.research.google.com/drive/1KijVuG_Ttk_bU6Ntzc0YmI7bfrEsR5io#printMode=true 3/3

You might also like