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.

32 lines
1023 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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