You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
662 B
33 lines
662 B
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());
|
|
// }
|
|
|
|
}
|
|
|