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
|
#include <iostream>
#include <iomanip>
using namespace std;
void getdata (int&, int&, float&);
float InstalledPrice (int , int, float );
float totalprice (float);
void printdata (int , int, float);
int main()
{
int length, width, count, i;
float installation, costpersqfoot, price;
cout << "Enter the amount of rooms.\n";
cin >> i;
for(count = i; count != 0; count --)
{ //beginning of for loop
getdata (length, width, costpersqfoot);
installation = InstalledPrice (length, width, costpersqfoot);
price = totalprice (installation);
printdata (length, width, price);
} //end of for loop
}
void getdata(int & length, int & width, float & costpersqft)
{
cin >> length >> width >> costpersqft;
}
float InstalledPrice (int length, int width, float costpersqfoot)
{
const float LABOR_COST = 0.35;
float sqfoot, installation;
sqfoot = length * width;
installation = (costpersqfoot * sqfoot) + (LABOR_COST * sqfoot);
}
float totalprice(float installation)
{
const float TAX_RATE = 0.05;
float price;
return(installation * TAX_RATE) + installation;
}
void printdata(int length, int width, float price)
{
cout << length << " " << width << " " << price << endl;
}
|