From 6f1dee1626bed68f27b25eb7f26faa2a422db783 Mon Sep 17 00:00:00 2001 From: aikang <2979801816@qq.com> Date: Thu, 6 Aug 2020 14:41:12 +0800 Subject: [PATCH] Main.java --- src/small_computer/Main.java | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/small_computer/Main.java 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); + } + } + +}