double sin = MathAssignment.sine(1.047197551);
After the execution of the above method call, the value stored in variable sin will be (approximately)
0.866025404, as the sine of 1.047197551 radians is approximately 0.866025404. The
sine of an angle x, denoted sin x, can be calculated using the following algorithm:
• If x < -π, repeatedly add 2π to x until -π ≤ x ≤ π. Conversely, if x > π, repeatedly subtract 2π
from x until -π ≤ x ≤ π. You MUST use 3.141592653589793 as a value
public class MathAssignment {
public static double sine(double rad) {
return Math.sin(rad);
}
}
Comments
Leave a comment