import java.util.Scanner; public class Calculate { /** * 吴家晨 */ public static void main(String[] args) { // TODO Auto-generated method stub int num; Scanner s=new Scanner(System.in); System.out.print("请输入第一位数:"); int num1=s.nextInt(); int num2=s.nextInt(); System.out.print("请输入运算符:"); char ch = s.next().charAt(0); switch(ch) { case '+': num=num1+num2; break; case '-': num=num1-num2; break; case '*': num=num1*num2; break; case '/': num=num1/num2; break; } System.out.print("num"); } }