- 5th Jul 2024
- 06:03 am
In this assignment the program should allow the user to enter expenses with at least the following data fields: Category Vendor Amount Date The program should allow the user to request a total amount of all expenses, with the following options: All expenses Expenses for a given Category (that the user enters) Expenses for a given Vendor (that the user enters) The program should allow the user to switch between entering in expenses and requesting totals For example, the user should be able to enter in, say, 3 transactions and then request a total of all expenses Then, the user should be able to enter in 2 more transactions and then request a total of all expenses for a given category This should continue until the user indicates that they wish to exit the program
Expense Tracker Program - Get Assignment Solution
Please note that this is a sample solution created by our Statistics Experts for the Expense Tracker Program assignment. These solutions are for research and reference only.
- Visit our Statistics Assignment Sample Solution page to download the complete solution, including code, report, and screenshots.
- Connect with our Tutors for online tutoring to help you understand and complete this assignment.
- Check out the partial solution for this assignment in the blog post below.
Free Assignment Solution - Expense Tracker Program
class Expense:
def __init__(self,category,vendor,amount,date):
self.__category = category
self.__vendor = vendor
self.__amount = amount
self.__date = date
def getCategory(self):
return self.__category
def getVendor(self):
return self.__vendor
def getAmount(self):
return self.__amount
def getDate(self):
return self.__date
def __str__(self):
return ("Category : " + self.__category +
"\nVendor : " + self.__vendor +
"\nAmount : " + str(self.__amount) +
"\nDate : " + self.__date)
def addExpense():
category = input("Enter Category: ")
vendor = input("Enter Vendor: ")
amount = float(input("Enter Amount: "))
date = input("Enter Date: ")
return Expense(category,vendor,amount,date)
def menu():
print("1. Add Expense")
print("2. Show All expense of a given category")
print("3. Show Expense of a given vendor")
print("4. Total amount of all expense")
print("5. Exit")
choice = input("Enter Your choice: ")
return choice
if __name__ == "__main__":
expense_list = []
while(True):
choice = menu()
if choice == "1":
expense_list.append(addExpense())
elif choice == "2":
category = input("Enter category:")
flag = False
for i in expense_list:
if i.getCategory() == category:
print(i)
print()
flag = True
if flag == False:
print("No Expense found with given category")
elif choice == "3":
vendor = input("Enter Vendor: ")
flag = False
for i in expense_list:
if i.getVendor() == vendor:
print(i)
flag = True
print()
if flag == False:
print("No Expense found with given vendor")
elif choice == "4":
sum_amount = 0
for i in expense_list:
sum_amount += i.getAmount()
print("Total Amount : " + str(sum_amount))
elif choice == "5":
break
else:
print("Wrong Choice!!! Try again...")
print()
Get the best Expense Tracker Program assignment and tutoring services from our experts now!
About The Author - Jane Doe
Jane Doe is an experienced software developer specializing in creating intuitive and user-friendly applications. With a strong background in financial software, Jane has designed the Expense Tracker Program to help users effortlessly manage and track their expenses. Her expertise in Python and data management ensures a seamless experience, allowing users to input expenses, categorize them, and request detailed summaries with ease.