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.

110 lines
2.2 KiB

4 years ago
package Internship;
public class jjcc {
static void sum(double a, double b) {
double resum=a+b;
System.out.println(a+"+"+b+"="+resum);
}
static void subtraction(double a,double b) {
double resub=a-b;
System.out.println(a+"-"+b+"="+resub);
}
static void mul(double a,double b) {
double remul=a*b;
System.out.println(a+"*"+b+"="+remul);
}
static void division(double a,double b) {
double redivision=0;
if(b!=0) {
redivision=a/b;
}
else {
redivision=0; /*<2A><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>*/
}
System.out.println(a+"<22><>"+b+"="+redivision);
}
}
package Internship;
public class ex {
static void e(int x) {
double e=Math.E;
double result;
result=Math.pow(e,x);
System.out.println("result="+result);
}
}
package Internship;
public class logax {
static void log(int a, int x) {
System.out.println("log"+a+" "+x+" = "+(Math.log(x)/Math.log(a)));
}
}
package Internship;
public class Trigonometric_Functions {
public Trigonometric_Functions(String chose,double Value) {
double a = Math.toRadians(Value);
switch(chose) {
case "sin":
System.out.println(String.format("%.2f",Math.sin(a)));
break;
case "cos":
System.out.println(String.format("%.2f",Math.cos(a)));
break;
case "tan":
System.out.println(String.format("%.2f",Math.tan(a)));
break;
}
}
}
package Internship;
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
int a, b;
Scanner sc = new Scanner(System.in);
System.out.println("<22><><EFBFBD><EFBFBD>a<EFBFBD><61>ֵ:");
a = sc.nextInt();
System.out.println("<22><><EFBFBD><EFBFBD>b<EFBFBD><62>ֵ:");
b = sc.nextInt();
System.out.println("<22>Ӽ<EFBFBD><D3BC>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD>:");
jjcc.sum(a, b);
jjcc.subtraction(a, b);
jjcc.mul(a, b);
jjcc.division(a, b);
System.out.println();
System.out.println("e<><65>x<EFBFBD>η<EFBFBD><CEB7><EFBFBD><EFBFBD><EFBFBD>:");
ex.e(a);
System.out.println();
System.out.println("logax<61><78><EFBFBD><EFBFBD>:");
logax.log(a, b);
System.out.println();
System.out.println("<22><><EFBFBD>Ǻ<EFBFBD><C7BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
Trigonometric_Functions tf1 = new Trigonometric_Functions("sin", 30);
Trigonometric_Functions tf2 = new Trigonometric_Functions("cos", 30);
Trigonometric_Functions tf3 = new Trigonometric_Functions("tan", 30);
}
}