delete

----
Last edited on
length = a+b+c+d;
area = (length * height) - (windows + doors) ;
length = a+b+c+d;
area = (length * height) - (windows + doors) ;


it doesn't work it should give me the same output :


Enter room height: 8
Enter wall length a: 15
Enter wall length b: 14
Enter wall length c: 10
Enter wall length d: 20
Enter number of windows: 4
Enter number of doors: 2
Total square footage: 686.0
Gallons: 3.71
Total gallons of paint to buy: 4

closed account (48T7M4Gy)
area = (length + width)* height - (windows + doors)

and, 8 x ( 15 + 14 + 10 + 20 ) - ( 4 x 6.5 ) - ( 2 x 26 ) = 394 sq ft not 686
You folks are forgetting the ceiling.

Ksalreqabi, can you post or describe the diagram? There isn't enough information in the text to calculate the area of the ceiling. Is one of the angles fixed?

In general, the way to approach a problem like this is to start with pencil and paper. Look at the diagram and figure out the formula for values requested. Maybe test the formulas with the data that the prof gives you. Only when you have the math right should you start to code it.
closed account (48T7M4Gy)
Good point about the ceiling :-}
Topic archived. No new replies allowed.