Question: make a python program called budgetPlanner.py. The program should calculate a monthly budget for the user based on the expenses of the months the user

make a python program called budgetPlanner.py. The program should calculate a monthly budget for the user based on the expenses of the months the user selected. It should also set aside a sinking fund for non-regular expenses.

The records of the previous expenses can be downloaded here: expenses.zip

  • It contains five text files: jan_expenses.txt, feb_expenses.txt, mar_expenses.txt, apr_expenses.txt, may_expenses.txt
  • Each line in the file follows the format of item, amount, category -- same as what we had in the spending tracker homework. We will only use the amount and category parts.
  • jan expenses info:
  • Starbucks,5.5,drink Starbucks,6.5,dining out Chipotle,15,dining out Raising Cane's,13,dining out rent,1000,housing utility bill,52.9,housing vegetables and fruits,35,grocery clothes,129,personal gas,100.23,vehicle Wendy's,10.9,dining out Starbucks,3.5,drink Kampai sushi,35.5,dining out
  • feb expense:
  • Starbucks,5.5,drink Starbucks,6.5,dining out Chipotle,15,dining out rent,1000,housing utility bill,55.9,housing vegetables and fruits,55,grocery gas,100.23,vehicle Wendy's,10.9,dining out Starbucks,3.5,drink Kampai sushi,35.5,dining out
  • march expense:
  • Chipotle,15,dining out rent,1000,housing utility bill,61.3,housing vegetables and fruits,50,grocery gas,100.23,vehicle Wendy's,10.9,dining out Starbucks,3.5,drink Kampai sushi,35.5,dining out shampoo,35.5,personal Claritin,10.97,medical
  • april expenses:
  • Starbucks,5.5,drink Starbucks,6.5,dining out Chipotle,15,dining out Raising Cane's,13,dining out rent,1000,housing utility bill,52.9,housing vegetables and fruits,35,grocery books,129,study pens,9.9,study gas,200.59,vehicle Wendy's,10.9,dining out Starbucks,3.5,drink Kampai sushi,35.5,dining out
  • may expense:
  • Starbucks,5.5,drink Raising Cane's,13,dining out rent,1000,housing utility bill,52.9,housing vegetables and fruits,95,grocery gas,200.59,vehicle Starbucks,3.5,drink car inspection,34,vehicle car registration,100,vehicle clothes,79,personal Details:
  1. First, the program should ask the user which months' expenses they'd like to use to calculate the budget:

Which months' expenses should be used to plan the budget: jan,feb

  • Please let the user enter names of the names as shown in the examples, i.e., jan, feb, mar, apr, may.
  • The user must enter all the months they want in one input.
  • No need to keep asking if the user wants to calculate another budget.
  • If the user only selects one or zero valid month, your program doesn't need to move forward to calculating the budget. It should print something to let the user know that the data is insufficient to calculate a budget.
  1. Second, the program calculates a monthly budget based on the selected month. Specifically,
    • For the categories that appear in more than one of the selected months:
      • We consider them as "regular" spending categories.
      • The monthly budget for these categories is calculated as: its total amount in all the selected months divided by the number of the selected months.
      • For example, if the user selected four months for calculating the budget, and they spent $10, $20, $14 in three of the months. Then the monthly budget for that category is .
    • For the categories that only appear in one of the selected months, regardless of how many times they appear in that month:
      • We consider them as sinking fund
      • sinking funds content: https://www.empower.com/the-currency/life/sinking-fund-categories
      • Since these categories only appear in one month, it wouldn't make sense to use the average as its budget.
      • So we'll combine all these sinking fund categories and only calculate a budget for the sinking fund.
      • The monthly budget for the sinking fund is calculated as: the total amount of all the sinking fund categories in the selected months divided by the number of theselectedmonths.
      • For example, if the user selected four months, and they spent $100 on personal stuff in only one of the month, $30 on study in only one of the month, then the monthly budget for the entire sinking fund is
  2. Finally, print the monthly budget nicely and also which categories belong to the sinking funds. (See example screenshots below for details.)

There is no requirement on what datatype you should use to store the expenses for future calculation. You may use lists or dictionaries. You may also define classes if you want.

Requirements

  • Organize your code nicely with functions.
    • No global variables.
    • Define at least three functions, including the main() function.
  • If the user enters an invalid month, simply skip that month and let the user it doesn't exist. Just use the valid months to calculate the budget.
  • Dont use import os
make a python program called budgetPlanner.py.
jj2cr@CENGR-W7RC931HW4 finalProject % python3 budget_planner . py Which months' expenses should be used to plan the budget: jan, feb Based on the analysis of your expenses for the selected months, your budget is calculated as follows: drink: $9.0 dining out: $74.4 housing: $1054.4 grocery: $45.0 vehicle: $100.23 Finally, you should leave $64.5 as sinking fund for occasional spending, such as things in the categories of: personal Example 2: Selected months: all five jj2cr@CENGR-W7RC931HW4 finalProject % python3 budget_planner . py Which months' expenses should be used to plan the budget: jan, feb, mar, apr, may Based on the analysis of your expenses for the selected months, your budget is calculated as follows: drink: $7.9 dining out: $60.82000000000901 housing: $1055. 1799999999998 grocery: $54.0 personal: $48.7 vehicle: $167.174 Finally, you should leave $29.974 as sinking fund for occasional spending, such as things in the categories of: medical study Example 3: Selected months: jan,mar,apr jj2cr@CENGR-W7RC931HW4 finalProject % python3 budget_planner . py Which months' expenses should be used to plan the budget: jan, mar, apr Based on the analysis of your expenses for the selected months, your budget is calculated as follows: drink: $7.166666666666667 dining out: $74.4 housing: $1055.7 grocery: $40.0 personal: $54.833333333333336 vehicle: $133.68333333333334 Finally, you should leave $49. 95666666666667 as sinking fund for occasional spending, such as things in the categories of: medical study

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Law Questions!