Hey guys,
I'm working on my homework assignment and I did all the code, but I can't figure out how to display the "hours of labor required" and The number of gallons of paint required.
Here is the assignment:
A painting company has determined that for every 115 square feet of wall space, one
gallon of paint and eight hours of labor will be required. The company charges
$18.00 per hour for labor. Write a modular program that allows the user to enter the
number of rooms that are to be painted and the price of the paint per gallon. It should
also ask for the square feet of wall space in each room. It should then display the fol-
lowing data:
• The number of gallons of paint required
• The hours of labor required
• The cost of the paint
• The labor charges
• The total cost of the paint job
Input validation: Do not accept a value less than 1 for the number of rooms. Do not
accept a value less than $10.00 for the price of paint. Do not accept a negative value
for square footage of wall space.
Any help would be great!
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
void instructions();
double Paint(double, int);
double Labor(int);
double Total(double,double);
void Output(double, int, double, double);
main()
{
int sqft;
double cpg, costlabor, costpaint, totalcost;
cout << showpoint << fixed << setprecision (2);
cout << "what is the square footage of the room? ";
cin >> sqft;
do
{
cout << "What is the cost per gallon of paint? ";
cin >> cpg;
if(cpg<10.)
cout << "Price must be at least $10.\n\n";
}
while(cpg<10);
costpaint=Paint(cpg, sqft);
costlabor=Labor(sqft);
totalcost=Total(costpaint, costlabor);
Output(totalcost, sqft, costpaint, costlabor);
}
double Paint(double cpg, int sqft)
{
return ceil(sqft/115.)*cpg;
}
double Labor(int sqft)
{
return sqft/115.*(18.00*8);
}
double Total(double paint,double labor)
{
return paint+labor;
}
void Output(double total, int sqft, double paint, double labor)
{
cout << "The number of gallons of paint required is ___\n";
cout << "The hours of labor required is ___\n";
cout << "The cost of the paint is $" << paint << endl;
cout << "The labor charges are $" << labor << endl;
cout << "The total cost of the paint job is $" << total << endl;
system("pause");
return;
}