parent
33761b70b6
commit
32090859cf
@ -0,0 +1,37 @@
|
||||
package calculator;
|
||||
import java.util.*;
|
||||
import java.math.*;
|
||||
|
||||
public class Calculate {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
//System.out.println("function:"); /*输入函数符号*/
|
||||
Scanner function= new Scanner(System.in); /*输入角度数*/
|
||||
String str=function.nextLine();
|
||||
|
||||
//System.out.println("radian:");
|
||||
Scanner radian= new Scanner(System.in);
|
||||
double d=radian.nextDouble();
|
||||
|
||||
if(str.equals("sin")) {
|
||||
System.out.println("="+Math.sin(Math.toRadians(d)));
|
||||
}
|
||||
else if(str.equals("cos")) {
|
||||
System.out.println("="+Math.cos(Math.toRadians(d)));
|
||||
}
|
||||
else if(str.equals("tan")) {
|
||||
System.out.println("="+Math.tan(Math.toRadians(d)));
|
||||
}
|
||||
else System.out.println("Error!");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in new issue