Well here is the program first
It isnt finished yet but working on it in pieces so I know what goes wrong when it does. My question is how do I get the total that I calculated from wall area into the other functions so I can do the math operations? I need the output of the program to be gallons of paint required, hours of labor, cost of paint, cost of labor and cost of job. For at least three of them I need to bring the total area of the wall into 3 other functions but it isnt working. Can I even do that?
Code:
Paint Job Estimation
#include <iostream>
using namespace std;
int numRooms();
int numGals(float);
float paintPrice(float);
float wallArea();
float laborHrs(float);
//void displayCost(int gallons, float paintPrice, float laborHrs);
int main()
{
float xprice = 0.3;
float gals = 0.1;
float xlabor = 0.2;
numRooms();
paintPrice(xprice);
wallArea();
numGals(gals);
laborHrs(xlabor);
return 0;
}
int numRooms()
{
int rooms;
cout << "Please enter the number of rooms: ";
cin >> rooms;
return rooms;
}
float paintPrice(float price)
{
cout << "Please enter the price per gallon: ";
cin >> price;
return price;
}
float wallArea()
{
float r1, r2, r3, r4, total;
cout << "Please enter the square feet of wall space for each room: " << endl;
cout << "Room 1: ";
cin >> r1;
cout << "Room 2: ";
cin >> r2;
cout << "Room 3: ";
cin >> r3;
cout << "Room 4: ";
cin >> r4;
total = r1 + r2 + r3 + r4;
return total;
}
int numGals(float gallons)
{
float total;
gallons = total / 160;
cout << "The number of gallons of paint required: " << gallons << " gallons" << endl;
return gallons;
}
float laborHrs(float labor)
{
float total;
labor = (total / 160) * 3;
cout << "The hours of labor required: " << labor << " hours" << endl;
return labor;
}
It isnt finished yet but working on it in pieces so I know what goes wrong when it does. My question is how do I get the total that I calculated from wall area into the other functions so I can do the math operations? I need the output of the program to be gallons of paint required, hours of labor, cost of paint, cost of labor and cost of job. For at least three of them I need to bring the total area of the wall into 3 other functions but it isnt working. Can I even do that?