Last function's coding needs correction

Everything calculates except for the last line: Total Cost of Paint Job. It gives a crazy number. Here is how the command prompt looks and my code is underneath. I also need to know how to round to hundredths but can probably find that on my own. Thank you.
--------------------------------------------------------------------------------
Paint Job Estimator

Enter the square footage you need to paint, then press enter
1000
Enter the price by gallons of paint you will use, then press enter
6
How many gallons of paint you will need: 8.69565
Your total paint cost will be: 52.1739
The number of hours for the job will be: 69.5652
The total amount of wages will be: 1391.3
The total price of your paint job will be: 6
Press any key to continue . . .
--------------------------------------------------------------------------------

#include <iostream>

using namespace std;

//function prototypes

void areaToPaintNeededAndCost(double theirAreaToPaint, double theirPaintCost, double theirPaintNeeded, double allTheirPaintCost);

void laborHoursNeededAndWages(double theirLaborHoursNeeded, double theirHoursWages, double theirAreaToPaint);

void totalPaintJobCost(double allTheirPaintCost, double allTheirWages, double theirTotalJobCost);

//Global Constants
const double AREA_FORMULA = 115.00; //115 square feet takes one gallon of paint,
const double AREAFORMULA_PAINT = 1.00; // gallon paint per 115 sq. ft.
const double AREAFORMULA_HOURS = 8.00; //8 hours of labor @ $20.00 per hour
const double AREAFORMULAHOURS_WAGES = 20.00;


int main()

{
double areaTP;
double paintCST = 0;
double paintNeeded = 0;
double allPaintCost = 0;
double hoursNeeded = 0;
double hoursWages = 0;
double allWages = 0;
double allJobCost = 0;


cout<<"Paint Job Estimator"<<endl;
cout<<endl;
cout<<"Enter the square footage you need to paint, then press enter"<<endl;
cin>>areaTP;

cout<<"Enter the price by gallons of paint you will use, then press enter"<<endl;
cin>>paintCST;


areaToPaintNeededAndCost(areaTP, paintCST, paintNeeded, allPaintCost);

//cout<<"How many gallons of paint you will need: "<<paintNeeded<<endl;
//cout<<"Your total paint cost will be: "<<allPaintCost<<endl;


laborHoursNeededAndWages(hoursNeeded, hoursWages, areaTP);
//cout<<"The number of hours for the job will be: "<<hoursNeeded<<endl;
//cout<<"The total amount of wages will be: "<<allWages<<endl;


totalPaintJobCost(paintCST, allWages, allJobCost);
//cout<<"The total price of your paint job will be: "<<allJobCost<<endl;

system("Pause");
//cin.get;
//cin.get;

return 0;
}

void areaToPaintNeededAndCost(double theirAreaToPaint, double theirPaintCost, double theirPaintNeeded, double allTheirPaintCost)
{

theirPaintNeeded = theirAreaToPaint / AREA_FORMULA * AREAFORMULA_PAINT;
allTheirPaintCost = theirPaintNeeded * theirPaintCost;

cout<<"How many gallons of paint you will need: "<<theirPaintNeeded<<endl;
cout<<"Your total paint cost will be: "<<allTheirPaintCost<<endl;
}

void laborHoursNeededAndWages(double theirLaborHoursNeeded, double theirHoursWages, double theirAreaToPaint)
{
theirLaborHoursNeeded = (theirAreaToPaint / AREA_FORMULA) * AREAFORMULA_HOURS;
theirHoursWages = theirLaborHoursNeeded * AREAFORMULAHOURS_WAGES;

cout<<"The number of hours for the job will be: "<<theirLaborHoursNeeded<<endl;
cout<<"The total amount of wages will be: "<<theirHoursWages<<endl;
}

void totalPaintJobCost(double allTheirPaintCost, double allTheirWages, double theirTotalJobCost)
{
theirTotalJobCost = allTheirPaintCost + allTheirWages;
cout<<"The total price of your paint job will be: "<<theirTotalJobCost<<endl;
}

------------------------------------------------------------------------------

Last edited on
Hello. Please use code and output tags. Thank you.

I don't think you specified a cost per gallon of paint.
Hi,
Sorry I'm so new at this I don't know what you mean by code and output tags.

The user enters the price they pay. The information I had to work with was:
115 sq. ft. needs one gallon of paint and 8 hours of labor at $20.00 per hour.

I'm supposed to have the user input the area they want painted and the price they paid for a gallon of paint. Then the program is to calculate number of gallons needed, price of paint according to what they supplied, hours of labor, cost of labor, then the total cost of the job. That's the part I'm having trouble with, getting it to add the total wages and total price of paint.

Thank you.
code and output tags make it look like this


1
2
3
4
5
6
7
8
9
10
11
int main()

{
double areaTP;
double paintCST = 0;
double paintNeeded = 0;
double allPaintCost = 0;
double hoursNeeded = 0;
double hoursWages = 0;
double allWages = 0;
double allJobCost = 0;


this is how you do it just dont add the .
[code.] code here [/code.]

or look under format: and push the button that looks like that <>
Topic archived. No new replies allowed.