Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The program worked before but an unexperienced programmer tried and enhance it and ended up ruining it ! ! ! Before attempting to fix it

The program worked before but an unexperienced programmer tried and enhance it and ended up ruining it!!! Before attempting to fix it, you need to know what the program was meant to do. See the program description below Description: "The program should allow the user to enter their monthly expenses and should then display the total monthly and yearly expenses based on what was entered". An example of how the program should work is shown below Enter the monthly rent or mortgage amount: 943
Enter the monthly amount spent on car insurance (if applicable): Enter the monthly amount spent on gas or transportation: 167
Enter amount spent on electricity: 230
Enter water bill amount: 120
Enter the monthly amount spent on Groceries: 300
Are there more expenses you would like to add? (yn : y
Enter the monthly amount spent Extra expenses: 120
Total monthly expense: $1980.00
Total annual expense: $23760.00
Important points to remember:
Notice from the example shown above, the program allows the user to enter addtional expenses if they have any. This is important to remember
.Pay attention to the way the totals are displayed in the end, notice there is no space between the dollar sign "$" and the total.
below are the program files, notice it uses functions. You can and should fix the functions if needed but you can NOT delete the functions
# The showExpenses function accepts mortgage/rent, car insurance (if applicable),
# gas or transportation, electric, water, and groceries # arguments and displays the equivalent total expense
# information.
def showExpenses(house, gas, ,insure, elec, water, grocery, extra)
totalMonth = housing + insurance + gas + elec + water + grocery
totalYear = totalMonth *12
return totalMonth, totalYear
# function displays total monthly and yearly expenses
def display (totalMonth, totalYear)
# Print monthly and annual information.
print ('{"Total monthly expense: 25 totalMonth: 2f')
print (f "Total annual expense:" 25 StotalYear:.2f')
import
exFunction.py as f
# main module
def main()
# Get the monthly payment for housing.
housing = float(input('Enter the monthly rent or mortgage
amount: ')
# Get the amount of insurance.
ins = input=('Enter the monthly amount spent on car
insurance(if applicable): ')
# Get the amount of gas.
gas = input('Enter the monthly amount spent on gas or
transportation: '))
# Get the amount of electiricy.
electricy = input('Enter amount spent on electriciy: ')
# Get the amount for water.
water = float(input('Enter water bill amount: "))
# Get the amount for Groceries.
groceries input('Enter the monthly amount spent on Groceries:# ask if there are other expenses they would like to include more =int (input("Are there more expenses you wouild like to add? (y/n): ")if more =' y '# get monthly amount spent on these additional expenses additional = float(input('Enter the monthly amount spentExtra expenses: 1))else:additional =0# calculate expensesfn.showExpenses(house, insurance, gas, electricy, water, groceries)# display results (monthly and annual total expensesdisplay(monExp , yearEx)Hints:
f string can be used to format output, I reference that in the videos I posted.
the program has pseudocode, comments, that should give you some guidance as to what code that appears below these comments is to do
Download the zipped folder below, it contains the two program files you need fix. When fixed, run the program and make sure that delivers results similar to what is shown above.
Create flowchart for program ( refer to posted Powerpoint "Flowcharts")
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions

Question

Define orientation, and explain the purposes of orientation.

Answered: 1 week ago

Question

What are the various career paths that individuals may use?

Answered: 1 week ago