I am working on a computer science project that requires a equation for a roof. This is what my teacher has down and I don't think it is correct:

(house height)squared + (house width/2)squared = roof width

then roof width * house length = roof area

Let Hh = the height of the rectangular house

Let Wh == the width of the rectangular house

Let Lh = the length of the rectangular house.

Let Hr = the height of the roof above the house height

Let Lr = the length of the rectangular roof = Lh

Let Wr = the width of each half of the rectangular roof.

Then, Wr = sqrt(Hr^2 + (Wh/2)^2

The area of the roof is then equal to 2(Wr((Lr).

If the height of the house is intended to be the height to the peak of the roof, then Hr = the height of the roof peak above the ground and Hh = the height of the rectangular house.

Then, Wr = sqrt[(Hr - Hh)^2 + (Wh/2)^2] and the roof area becomes

Ar = 2[sqrt(Hr - Hh)^2 + (Wh/2)^2]Lr