master^2
unknown 4 years ago
parent 2f0e8722c2
commit cfca26f64a

@ -0,0 +1,59 @@
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("错误");
}
}
Loading…
Cancel
Save