I'm not sure where to even start this assignment:
In shopping for a new house, you must consider several factors. In this problem the initial cost of the house, the estimated annual fuel costs, and the annual tax rate are available. Write a program that determines and displays the total cost of a house after a five-year period and execute the program for each of the following sets of data:
Initial House Cost Annual Fuel Cost Tax Rate
167,000 3,300 0.025
162,000 3,500 0.025
175,000 2,850 开发者_StackOverflow 0.025
To calculate the house cost, add the initial cost to the fuel cost for five years, then add the taxes for five years. Taxes for one year are computed by multiplying the tax rate by the initial cost. Show testing for your program as discussed in lab and lecture.
Any help with writing the initial function and the constants would be greatly appreciated!
To calculate the house cost, add the initial cost
initial_cost
to the fuel cost for five years,
YEARS = 5
initial_cost + YEARS * annual_fuel_cost
then add the taxes for five years. Taxes for one year are computed by multiplying the tax rate by the initial cost.
initial_cost + YEARS * annual_fuel_cost + YEARS * initial_cost * tax_rate
You should start by reading the basics at python.org.
Then you just do T=A+B*5+A*C*5
for each of your data sets.
Finally consult your lab and lecture notes to see how to show testing.
精彩评论