A few things:
1. A right angle is, by definition, exactly 90 degrees.
2. Assuming the wall is a normal, perfectly vertical wall, then a ladder placed perpendicular to it would be perfectly horizontal.
3. I don't see a use for a UML diagram here but if it's for school,
you should ask your teacher for clarification. I suspect you don't need to include intermediate variables.
4. Do the calculations by hand first, then translate the calculation process into code.