I must use void paintPrice(float&area) and floatwallArea() as my functions. Can
ID: 3613754 • Letter: I
Question
I must use void paintPrice(float&area) and floatwallArea() as my functions. Can youhelp me make these changes in this program??#include <iostream>
#include<iomanip>
using namespace std;
int numRooms();
int numGals(float);
float paintPrice();
float wallArea(int);
float laborHrs(float);
void displayCost(int,float,float );
int main()
{
int rooms,i,gals;
float ppg,wall,hrs;
rooms=numRooms();
ppg=paintPrice();
wall=wallArea(rooms);
gals=numGals(wall);
hrs=laborHrs(wall);
displayCost(gals,ppg,hrs);
return 0;
}
void displayCost (int gal, float price, float hrs)
{
float total,labor,paint;
paint=price*gal;
labor=hrs*34;
total=paint+labor;
cout<<"Gallons of paint:"<<setw(6)<<fixed<<setprecision(2)<<gal<<endl;
cout<<"Hours labor: "<<setw(6)<<fixed<<setprecision(2)<<hrs<<endl;
cout<<"Paint cost: $"<<setw(6)<<fixed<<setprecision(2)<<paint<<endl;
cout<<"Labor cost: $"<<setw(6)<<fixed<<setprecision(2)<<labor<<endl;
cout<<"Total cost: $"<<setw(6)<<fixed<<setprecision(2)<<total<<endl;
return;
}
float laborHrs(float area)
{
float hr;
hr=area/115*2;
return hr;
}
float wallArea(int n)
{
int i,num;
float sum=0;
for(i=1;i<=n;i++)
{
do
{
cout<<"Enter wall area forroom "<<i<<": ";
cin>>num;
if(num<100)
cout<<"areaof each wall must be at least 100 ";
}
while(num<100);
sum+=num;
}
return sum;
}
float paintPrice()
{
float n;
cout<<"Enter price per gallon of paint? ";
cin>>n;
return n;
}
int numGals (float area)
{
int gal;
gal=(int)(area/115+.9);
return gal;
}
int numRooms()
{
int n;
cout<<"Enter number of rooms? ";
cin>>n;
return n;
}
I must use void paintPrice(float&area) and floatwallArea() as my functions. Can youhelp me make these changes in this program??
#include <iostream>
#include<iomanip>
using namespace std;
int numRooms();
int numGals(float);
float paintPrice();
float wallArea(int);
float laborHrs(float);
void displayCost(int,float,float );
int main()
{
int rooms,i,gals;
float ppg,wall,hrs;
rooms=numRooms();
ppg=paintPrice();
wall=wallArea(rooms);
gals=numGals(wall);
hrs=laborHrs(wall);
displayCost(gals,ppg,hrs);
return 0;
}
void displayCost (int gal, float price, float hrs)
{
float total,labor,paint;
paint=price*gal;
labor=hrs*34;
total=paint+labor;
cout<<"Gallons of paint:"<<setw(6)<<fixed<<setprecision(2)<<gal<<endl;
cout<<"Hours labor: "<<setw(6)<<fixed<<setprecision(2)<<hrs<<endl;
cout<<"Paint cost: $"<<setw(6)<<fixed<<setprecision(2)<<paint<<endl;
cout<<"Labor cost: $"<<setw(6)<<fixed<<setprecision(2)<<labor<<endl;
cout<<"Total cost: $"<<setw(6)<<fixed<<setprecision(2)<<total<<endl;
return;
}
float laborHrs(float area)
{
float hr;
hr=area/115*2;
return hr;
}
float wallArea(int n)
{
int i,num;
float sum=0;
for(i=1;i<=n;i++)
{
do
{
cout<<"Enter wall area forroom "<<i<<": ";
cin>>num;
if(num<100)
cout<<"areaof each wall must be at least 100 ";
}
while(num<100);
sum+=num;
}
return sum;
}
float paintPrice()
{
float n;
cout<<"Enter price per gallon of paint? ";
cin>>n;
return n;
}
int numGals (float area)
{
int gal;
gal=(int)(area/115+.9);
return gal;
}
int numRooms()
{
int n;
cout<<"Enter number of rooms? ";
cin>>n;
return n;
}
Explanation / Answer
please rate - thanks #include #include using namespace std; int numRooms(); int numGals(float); float paintPrice(float&); float wallArea(); float laborHrs(float); void displayCost(int,float,float ); int main() { int rooms,i,gals; float ppg,wall=0,hrs; rooms=numRooms(); for(i=1;iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.