TrigonometricFunction.java

master
pt2vw7q5o 4 years ago
parent ef8c637660
commit 8ca9483315

@ -0,0 +1,32 @@
package ;
import java.math.*;
public class TrigonometricFunction {
static double x;
public TrigonometricFunction (double x)
{
this.x=x;
}
public static double sin( ) //计算角度x对应的正弦值
{
return Math.sin(Math.toRadians(x));//Math.toRadians()将角度转换为弧度
}
public static double cos()//计算角度x对应的余弦值
{
return Math.cos(Math.toRadians(x));
}
public static double tan()//计算角度x对应的正切值
{
return Math.tan(Math.toRadians(x));
}
// public static void main (String[] args)
// {
// double x=90;
// TrigonometricFunction t=new TrigonometricFunction(x);
// System.out.println(t.sin());
// }
}
Loading…
Cancel
Save