From dc660dc0c4e685ae5b791824de75d3fb11804610 Mon Sep 17 00:00:00 2001 From: 691798 <691798773@qq.com> Date: Thu, 6 Aug 2020 20:59:48 +0800 Subject: [PATCH] sj.java --- sj.java | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 sj.java diff --git a/sj.java b/sj.java new file mode 100644 index 0000000..72458da --- /dev/null +++ b/sj.java @@ -0,0 +1,32 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package calculator; + +import java.util.*; +public class sj { + + + public sj() { + Scanner inScanner=new Scanner(System.in); + System.out.print("请输入一个运算(单位为度):"); + int a=inScanner.nextInt(); + System.out.print("接下来摁1是sin函数,2是cos函数,3是tan函数"); + int y=inScanner.nextInt(); + if(y==1){ + double x = Math.toRadians(a); + System.out.println(Math.sin(x)); + } + if(y==2) { + double b = Math.toRadians(a); + System.out.println(Math.cos(b)); + } + if(y==3){ + double c = Math.toRadians(a); + System.out.println(Math.tan(c)); + + } + } +} \ No newline at end of file