parent
ae7fcebfd4
commit
e2716c9e59
@ -0,0 +1,33 @@
|
||||
package cn.csj.oo3;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
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; /*表示错误*/
|
||||
}
|
||||
System.out.println(a+"÷"+b+"="+redivision);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue