diff --git a/TrigonometricFunction.java b/TrigonometricFunction.java new file mode 100644 index 0000000..7565a7c --- /dev/null +++ b/TrigonometricFunction.java @@ -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()); +// } + +} +