/* * 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)); } } }