diff --git a/src/small_computer/Main.java b/src/small_computer/Main.java new file mode 100644 index 0000000..8388409 --- /dev/null +++ b/src/small_computer/Main.java @@ -0,0 +1,26 @@ +package small_computer; +import java.util.Scanner; +public class Main { + + public static void main(String[] args) { + Subtraction ss=new Subtraction(); + Division dd=new Division(); + System.out.println("1-加法计算 2-减法运算"); + System.out.println("3-乘法运算 4-除法计算"); + System.out.println("请输入选择:"); + Scanner sc=new Scanner(System.in); + int n=sc.nextInt(); + System.out.println("请输入两个运算数:"); + int a=sc.nextInt(); + int b=sc.nextInt(); + if(n==2) { + int c=(int) ss.sub(a, b); + System.out.println(c); + } + else if(n==4) { + int c=(int) dd.div(a, b); + System.out.println(c); + } + } + +}