package java联系;
import java.util.*;
public class test {
static void add()
{
int num1,num2;
int sum=0;
System.out.println("请输入两个数: ");
Scanner reader = new Scanner(System.in);
num1 = reader.nextInt();
num2 = reader.nextInt();
sum =num1+num2;
System.out.println("和是 "+sum);
}
static void jian()
{
int num1,num2;
int sum = 0;
System.out.println("请输入两个整数: ");
Scanner in = new Scanner(System.in);
num1 = in.nextInt();
num2 = in.nextInt();
System.out.println("两个数相减为: "+(num1-num2));
}
public static void main(String[] args) {
int choice;
System.out.println("********");
System.out.println("简易计算机");
System.out.println("********");
Scanner reader = new Scanner(System.in);
choice = reader.nextInt();
switch(choice)
{
case 1:
add();
break;
case 2:
jian();
break;
case 3:
break;
case 4:
break;
}
}
}
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/114849.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...