0

Ok, I am supposed to calculate the angle of a right triangle using Java. The measurements of the sides are a = 3 and b = 4 with the hypotenuse being c = 5. If I use Math.sin, it does not calculate the angle created by a and c. Is there another Math function I am not aware of? I have spent a long time trying to figure this out to no avail. Thanks in advance.

2
  • First calculate the angle by hand (with a scientific calculator). If you don't know how, you should ask a question on our sister site Mathematics. Commented Sep 29, 2013 at 22:55
  • 1
    It is NOT 90 degrees. Commented Sep 29, 2013 at 23:34

2 Answers 2

1

The probably source of the problem is that sin works in radians, rather than degrees.

Sign up to request clarification or add additional context in comments.

Comments

0

To find the angle bounded by the side a and the side c, try using Math.toDegrees(Math.acos((double)a/c)). The passed value d to Math.acos(d) will have to be double.'Math.acos(d)' will give the arc cos in radian. Go through Math documentation

5 Comments

It depends on exactly which angle he wants, which isn't clear. If "the angle created by a and c" means "the angle bounded by the side a and the side c", then I think he needs acos, not asin. But the wording isn't clear.
Yes, I meant I need to find the angle created by a and c.
@ajb Actually my intention was to respond for the question: If I use Math.sin, it does not calculate the angle created by a and c. Is there another Math function I am not aware of? so to create angle we use Math.asin(d) instead of Math.sin(d). His wording wasn't clear to me either.
See, I thought asin was used to find the length of the arc created by the angle and radius. If asin is used to find the angle, what is used to find the arc?
it is ok. We caught your drift.:)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.