Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
|
32090859cf | 5 years ago |
@ -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!");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,16 +1,5 @@
|
|||||||
package fengshiji;
|
package fengshiji;
|
||||||
import java.math.*;
|
|
||||||
public class fengshiji1
|
|
||||||
{
|
|
||||||
public double duishu(double a,double b)
|
|
||||||
{
|
|
||||||
double res = log(a, b);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
private double log(double a, double b) {
|
public class fengshiji1 {
|
||||||
double h=Math.log10(b)/Math.log10(a);
|
|
||||||
return h;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue