Hello guys!
I want to program something that tells me how many gallons of paint I need and what the total cost of the painting . I gotta say I am new to this, I hope the question dosen't seem that silly
Code:
// Headers and Other Technical Items
#include <iostream>
using namespace std;
// Function Prototypes
void pause(void);
//
double length;
double width;
double height;
double price_gal_paint;
int coverage_gal_paint;
double total_area;
int total_gal_paint;
double total_cost;
//******************************************************
// main
//******************************************************
int main(void)
{
// Input
cout << "\nEnter the price of 1 gallon of paint";
cin >> price_gal_paint;
cout << "\nEnter the length of the house ";
cin >> length;
cout << "\nEnter the width of the house ";
cin >> width;
cout << "\nEnter the height of the house ";
cin >> height;
cout << "\nEnter the amount of square foot one gallon will cover ";
cin >> coverage_gal_paint;
// Process
// calculate the total area of the building by
x = length * height * 2 ;
y = width * height * 2;
total_area = x + y;
//calculate the number of gallons of paint needed by
total_gal_paint = total_area / coverage_gal_paint;
total_gal_paint = total_area / coverage_gal_paint + 0.9999;
total_cost = total_gal_paint * price_gal_pain;
// Output
cout << "\nThe number of gallons of paint is -------->: ";
cout << answer;
cout << "\nThe total cost of the paint is -------->: ";
cout << answer;
pause();
return 0;
}
//******************************************************
// pause
//******************************************************
void pause(void)
{
cout << "\n\n";
system("PAUSE");
cout << "\n\n";
return;
}
I hope everything is right. But I do have a question about the following code..
Code:
// calculate the total area of the building by
x = length * height * 2 ;
y = width * height * 2;
total_area = x + y;
I know it cant be just x and y now. But if I did total_area for x and y it wouldn't calculate it right. I think I have enough variables.. I don't know.. I kinda don't know how do do this part.
I believe I need to more variables for this..?
Thank you!!