From fb0fa3b493d66a911b16dcd49987da8fb042fbb9 Mon Sep 17 00:00:00 2001 From: lh0923 <3029505674@qq.com> Date: Thu, 10 Oct 2024 14:59:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A1=E7=AE=97=E5=99=A8=E5=8A=A0=E5=87=8F?= =?UTF-8?q?=E4=B9=98=E9=99=A4=E5=8F=96=E4=BD=99=E7=AD=89=E7=9A=84=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- calculator.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 calculator.java diff --git a/calculator.java b/calculator.java new file mode 100644 index 0000000..6224d86 --- /dev/null +++ b/calculator.java @@ -0,0 +1,17 @@ +import java.util.Scanner; + +public class calculator { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + + System.out.print("请输入第一个数:"); + double num1 = scanner.nextDouble(); + + System.out.print("请输入第二个数:"); + double num2 = scanner.nextDouble(); + + System.out.print("请选择操作符 (+, -, *, /, %):"); + String operation = scanner.next(); + + +}