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.

34 lines
596 B

4 years ago
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);
}
}