1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
#include <iostream>
using namespace std;
//declare functions
void getInfo(double, double, double);
double aTax(double, double);
double fuelfive(double);
double house(double, double, double);
void displayInfo(double, double, double, double);
int main()
{
double init1, fuel1, rate1, tax1, year1, five1, total1;
//get information from user
getInfo(init1, fuel1, rate1);
//calculate annual tax
year1 = aTax(init1, rate1);
//calculate five year fuel
five1 = fuelfive(fuel1);
//calculate house totals
total1 = house(five1, init1, year1);
//display information
displayInfo(init1, fuel1, year1, total1);
return 0;
}
//**************************getInfo************************************
void getInfo(double init, double fuel, double rate) {
cout << "Please enter the initial house cost: " << endl;
cin >> init;
cout << "Please enter the annual fuel cost: " << endl;
cin >> fuel;
cout << "Please enter the annual tax rate (do not include percent sign):" << endl;
cin >> rate;
}
//**************************aTax************************************
double aTax(double init, double TR) {
double tax;
tax = TR/100;
double year;
year = initial * tax;
return year;
}
//**************************FUELFIVE**********************************
double fuelfive(double one) {
double fiveyr;
fiveyr = fuelone * 5;
return fiveyr;
}
//**************************HOUSE**********************************
double house(double fiveyear, double yearly, double initial) {
double housetot;
housetot = (yearly * 5) + initial + fiveyr;
return housetot;
}
//**************************displayInfo************************************
void displayInfo(double initial, double fuel, double year, double tot) {
cout << "Initial house cost: " << initial<< endl;
cout << "Annual Fuel Cost: " << fuelone << endl;
cout << "Yearly Tax Amount is: " << yearly << endl;
cout << "Total House Cost: " << total << endl;
cout << "---------------------------------------" << endl;
}
|