parent
887b2bf895
commit
e57f58f67d
@ -0,0 +1,9 @@
|
||||
package open;
|
||||
|
||||
public class duishu {
|
||||
|
||||
public double duishu(double a,double b) {
|
||||
return Math.log(a)/Math.log(a);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package open;
|
||||
import java.util.Scanner;
|
||||
public class main {
|
||||
|
||||
public main() {
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
double a,c; String b;
|
||||
Scanner sc = new Scanner(System.in);
|
||||
a=sc.nextDouble();
|
||||
b=sc.next();
|
||||
if(b.equals("sin")) {
|
||||
sanjiao d=new sanjiao();
|
||||
System.out.println(d.sanjiao("sin", a));
|
||||
}
|
||||
else if(b.equals("cos")) {
|
||||
sanjiao d=new sanjiao();
|
||||
System.out.println(d.sanjiao("cos", a));
|
||||
}
|
||||
else if(b.equals("tan")) {
|
||||
sanjiao d=new sanjiao();
|
||||
System.out.println(d.sanjiao("tan", a));
|
||||
}
|
||||
else if(b.equals("^")) {
|
||||
zhishu d=new zhishu();
|
||||
System.out.println(d.zhishu(a));
|
||||
}
|
||||
else if(b.equals("log")) {
|
||||
duishu d=new duishu();
|
||||
c=sc.nextDouble();
|
||||
System.out.println(d.duishu(a, c));
|
||||
}
|
||||
else if(b.equals("+")) {
|
||||
sizeyunsuan d=new sizeyunsuan();
|
||||
c=sc.nextDouble();
|
||||
System.out.println(d.add(a, c));
|
||||
}
|
||||
else if(b.equals("-")) {
|
||||
sizeyunsuan d=new sizeyunsuan();
|
||||
c=sc.nextDouble();
|
||||
System.out.println(d.subtract(a, c));
|
||||
}
|
||||
else if(b.equals("*")) {
|
||||
sizeyunsuan d=new sizeyunsuan();
|
||||
c=sc.nextDouble();
|
||||
System.out.println(d.multiply(a, c));
|
||||
}
|
||||
else if(b.equals("/")) {
|
||||
sizeyunsuan d=new sizeyunsuan();
|
||||
c=sc.nextDouble();
|
||||
System.out.println(d.divide(a, c));
|
||||
}
|
||||
else System.out.println("´íÎó");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package open;
|
||||
|
||||
public class sanjiao {
|
||||
|
||||
public double sanjiao(String a,double b) {
|
||||
double c=Math.toRadians(b);
|
||||
if(a=="sin")
|
||||
return Math.sin(c);
|
||||
else if(a=="cos")
|
||||
return Math.cos(c);
|
||||
else if(a=="tan")
|
||||
return Math.tan(c);
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package open;
|
||||
|
||||
public class sizeyunsuan {
|
||||
|
||||
public double add(double add1, double add2) {
|
||||
//¼Ó·¨
|
||||
double result;
|
||||
result = add1 + add2;
|
||||
return result;
|
||||
}
|
||||
|
||||
public double subtract(double sub1, double sub2) {
|
||||
//¼õ·¨
|
||||
double result;
|
||||
result = sub1 - sub2;
|
||||
return result;
|
||||
}
|
||||
|
||||
public double multiply(double mul1, double mul2) {
|
||||
//³Ë·¨
|
||||
double result;
|
||||
result = mul1 * mul2;
|
||||
return result;
|
||||
}
|
||||
|
||||
public double divide(double div1, double div2) {
|
||||
//³ý·¨
|
||||
double result;
|
||||
result = div1 / div2;
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package open;
|
||||
|
||||
public class zhishu {
|
||||
|
||||
public double zhishu(double a) {
|
||||
return Math.pow(Math.E,a);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in new issue