package com.chen.method;
import java.util.Scanner;
public class Demo07 {
public static void main(String[] args) {
for(int i = 0;i>=0;i++){
Scanner scanner = new Scanner(System.in);
System.out.println("请输入两个数字与算数符号,各个之间加空格:");
int a=scanner.nextInt();
String suanfa= scanner.next();
int b=scanner.nextInt();
switch (suanfa) {
case "+" :
System.out.println(a+"+"+b+"="+add(a,b));
break;
case "-" :
System.out.println(a+"-"+b+"="+del(a,b));
break;
case "*" :
System.out.println(a+"*"+b+"="+cheng(a,b));
break;
case "/" :
System.out.println(a+"/"+b+"="+chu(a,b));
break;
}
}
}
public static int add(int a,int b){
return a+b;
}
public static int del(int a,int b){
return a-b;
}
public static int cheng(int a,int b){
return a*b;
}
public static int chu(int a,int b){
return a/b;
}
}