#include <iostream>
#include <iomanip>
#include <cmath>
usingnamespace std;
int main()
{
float fHeight, fWidth, fLength, fPaintSpace, fGallonCost, fArea, fArea2, fCost;
cout << "Welcome to the Paint Calculator (version 1.0.0)!\n\n";
cout << "What is the height of the room to be painted?\n";
cin >> fHeight;
cout << "What is the width of the room to be painted?\n";
cin >> fWidth;
cout << "What is the length of the room to be painted?\n";
cin >> fLength;
cout << "How much space can one gallon of the desired paint cover?\n";
cin >> fPaintSpace;
cout << "How much does one gallon of the desired paint cost?\n";
cin >> fGallonCost;
fArea = fHeight * fWidth;
fArea2 = fHeight * fLength;
fArea *= 2;
fArea2 *= 2;
fArea += fArea2;
fArea = fArea / fPaintSpace;
fCost = (ceil (fArea)) * fGallonCost;
cout << "\nYou will need " << ceil (fArea) << " gallons of paint.\n";
cout << "Which will cost $" << setprecision(2) << fixed << fCost << endl;
return 0;
} // end main
I ran it with a test value of fGallonCost 10, the program then proceeded to tell me that I needed one gallon with a cost of 20. I know that this must be a logic error... come one though, I am a new programmer and I'm only in my early 20's. That's to be expected right?
I tried it with a Heigth of 1, Width 1, Length 1, Paint space 1, and cost 1. And I get only $4. So excluding the floor, I think you're missing a another side somewhere, maybe ceiling? O.o
Maybe changing fArea2 *= 2; to fArea2 *= 3; To include the ceiling.