help me to solve this question for making c++

(help me to solve this question for making c++)
hi all..i want ask..how to do this script for C++? my tutor ask me to do it but i zero in c++...the syntax i know...but i dont know what minus,times,plus and divide for this formula...someone help me tq

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
QUESTION 2
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 will determine the total cost of a house after a five-year period and run the program to repeat entering sets of data. 
The following table shows the examples of data required. 
Finally, determine which of the house is considered as the best buy.

Initial House Cost	Annual Fuel Cost	Tax Rate
67,000	                    2,300	         0.025
62,000	                    2,500	         0.025
75,000	                    1,850	         0.020

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.
Last edited on
Hi there,

It's not this forum's policy to make people's homework for them, rather, we try to assist you so that you learn something along the way. The assignment is pretty clear in that it tells you pretty much everything you need.

Let's break it down:

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 will determine the total cost of a house after a five-year period and run the program to repeat entering sets of data.


You will need to store the initial_cost, the fuel_cost and the tax_rate for every house that is entered. Hence, you will need to ask the user for this data and store it appropriately. If you have learned about structs yet, I would advice you to make an array of house-structs. If you haven't learnt about structs yet, you could make 3 separate arrays, one for the initial cost, one for fuel cost and one for tax rate.

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.


total_house_cost = initial_cost + (fuel_cost*5) + (5*(tax_rate * initial_cost))

Finally, determine which of the house is considered as the best buy.


You will need to calculate total_house_cost for every house and pick the house with the lowest price.

That should get you started. Please do let us know if you require any further help after you have made a fair attempt at writing the code.

All the best,
NwN
1) you need 3 "long"s to hold the initial cost, 3 "long"s to Fuel costs, 3 "double"s to tax rates and 3 "double"s to total cost.

2) declare total costs as 0

3) multiply fuel costs with 5 and add the results to total costs

4) multiply initial cost with tax rate and add the result to total costs

5) add the initial cost to total costs

6) check total costs to find cheapest one

7) show the cheapest house
wow many thanks all...for helping me in the formula...the question i know how to do...just the equation for the formula what plus minus devive and so on...anyway thanks all...i really appreciate it..im gonna try..tq
Topic archived. No new replies allowed.