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
|
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
void getdata (int& length , int& width, float& costperdqfoot);
float InstalledPrice (int length, int width, float costpersquarefoot);
float totalprice (float installation);
void printdata (int length, int width, float price, float installation, float total);
const float LABOR_COST=0.35;
const float TAX_RATE=0.05;
int main()
{
int length, width;
float installation, total, costpersqfoot, price;
int num;
cout<< "Enter the amount of the count:"<<endl;
cin>>num;
const int MAXCOUNT = num;
int count;
for (count = 0; count < MAXCOUNT; count++)
{
getdata (length, width, costpersqfoot);
installation = InstalledPrice (length, width, costpersqfoot);
total = totalprice (installation);
printdata (length, width, price);
}
system("pause");
return 0;
}
void getdata (int& length, int& width, float& costpersqfoot)
{
cout<< "Eneter the length, width, and cost per square foot"<<endl;
cin>> length >> width >> costpersqfoot;
}
float InstalledPrice (int length, int width, float costpersqfoot)
{
return (length*width*costpersqfoot)+(length*width*LABOR_COST);
}
float totalprice (float installation)
{
return (installation*TAX_RATE);
}
void printdata (int length, int width, float price, float installation, float total)
{
cout<< "The cost for installation is: "<< installation<< endl;
cout<< "The total cost with tax is: "<< total<< endl;
|