Hey all, I'll just get straight to it, when I input a vertical height of 4 and a top angle of 30 (in degrees) I get ridiculous answers,
for example, the ladder length should be 5, and the floor length should be 3 (a 3, 4, 5 triangle) but I get huge decimal answers and can't figure out why.
Here is the code of the class containing the main method and scanner
And this is the code of the calculations etc
My other, generic, question is about the constructor and the print statements at the end of the User class. Do I have to assign values to things such as bottomAngle, floorLength etc in the constructor, and then use +bottomAngle in the println statements?
Or is there a way I can use getBottomAngle() and call the "local variable" (is that the right term)??
Thanks for all your help so far guys.
The reason I'm not sure what the problem is, is because it is clearly not giving me the answer as if I had done cosine, sine, or tangent of the input angle in radians, I have checked on my calculator and I've no idea where these values are coming from!!
Everything there looks okay to me except for your assertion that a 3-4-5 right triangle has a 30-degree angle, and that shouldn't make a huge difference. (I haven't seriously checked your trig calculations either but they look like they're going in the right direction anyway.)
So can you post more detail about the answers you're getting? I'm sure you aren't going to get 5 for ladder length, but you should get something around there.
Joined: Oct 28, 2012
This is why I shouldn't do these things at such ridiculous times.
You're correct, and I'm taking a maths degree thinking a 3 4 5 triangle has a 30 degree angle :|
I'm just going to say ohhh it happens to the best of us and quietly brush this one away ;)