Hey everyone.
Last time I posted on here I got some very helpful advice and was able to finish my program :). Hopefully it'll happen again.
I'm basically stuck at the calculations part of my program.
I have to calculate the amount of concrete (in cubic meters) needed in a rectangular room, given that there is an opening in the room (i.e a doorway). Sounds easy enough.
The formula for volume for a rectangle(in cubic meters) is V = Length x Width x Height.
But I'm not interested in the total volume of the room, rather the volume of individual walls. Therefore I'm thinking my formula will be something like this:
V = Thickness x Width x Height for Wall 1
V = Thickness x Width x Length for Wall 2.
V = Thickness x Width x Height for Wall 3.
V = Thickness x Width x Length for Wall 4.
+__________________________________________
Total Volume of Walls for a rectangular room.

Total Volume of Opening for a rectangular room.
????
Profit
I'm hoping that there's some mathematicians out there that can help me out because there seems to be something wrong with my calculations.
Let's assume that the numbers are already given; here's my attempt at the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main ()
{
double length = 50;
double width = 30;
double height = 2.1;
double thickness = .05;
double opening = 25.5;
float S1 = width * height * thickness;
float S2 = length * height * thickness;
float S3 = width * height * thickness;
float S4 = length * height * thickness;
float S5 = (S1 + S2 + S3 + S4)  (opening * height * thickness);
cout << "Total amount of concrete needed:" << S5 << endl;
return 0;
}
 
These are the numbers that the professor uses in her example terminal output.
Her answer is 14.101
However when you compile my code you get 14.1225.
So what am I doing wrong?
If you guys need an illustration to see what I mean please go here:
http://web.cs.unlv.edu/lee/cs135/wall_sketch.pdf
And if you would like to see the full prompt please go here:
http://web.cs.unlv.edu/lee/cs135/assign04_cs135fa12.html
Thank you