Hey guys,
I need help with this program which I have a function that calculates this formula for total house cost and then have an instruction function that asks for the input, then in main has the output. Can anyone tell me waht I am doing wrong, I think I have to return something in the instructions function but I don't know what! Please help! Thanks!
#include <iostream>
#include <cmath>
using namespace std;
float totalHouseCost (float initial, float fuel, float taxRate)
{
float totalFuelCost = fuel * 5; // Fuel for 5 years
float totalTaxes = taxRate * initial * 5; // Taxes for 5 years
float totalCost = initial + totalFuelCost + totalTaxes; /*Initial House cost
+ fuel cost for 5 years + Tax Rate for 5 years */
}
void displayInstructions () //defining instructions
{
float initial, fuel, taxRate;
cout << "The following program will display 3 homes." << endl;
cout << "Determine which is the best buy after 5 years of cost." << endl;
cout << " Enter initial cost of house" << endl;
cin >> initial;
cout << " Enter fuel cost of house for 5 years" << endl;
cin >> fuel;
cout << " Enter tax rate of house for 5 years" << endl;
cin >> taxRate;
}
int main()
{
float initial, fuel, taxRate;
displayInstructions(); //call on instructions for user
cout << "House of intial cost of " << initial << ", annual fuel cost "
<< fuel << " and annual tax rate" << endl;
cout << taxRate << " Has a 5 year cost of: " << totalHouseCost(initial, fuel, taxRate) << endl;
cout << "\n\n\n\n";
cout << "\n\n\n\n";
cout << "Jordan McGehee Lab2Pb8JM.cpp " << endl;
cout << "Lab 2 Problem 8 pg. 159 Due 03-03-08 " << endl;
system ("pause");
return 0;
}//end main