From 8ca9483315f25aa50dd18a4d2614d39dd273b724 Mon Sep 17 00:00:00 2001 From: pt2vw7q5o <1489827879@qq.com> Date: Thu, 6 Aug 2020 17:18:54 +0800 Subject: [PATCH] TrigonometricFunction.java --- TrigonometricFunction.java | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 TrigonometricFunction.java 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()); +// } + +} +