add package calculator

This commit is contained in:
xixu-me committed 2024-03-22 17:14:25 +08:00
1 parent 054b77ccdd
commit 062beda77e
7 files changed
+72

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
package calculator;
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
try (Scanner sc = new Scanner(System.in)) {
while (true) {
System.out.print(">>> ");
int a = sc.nextInt();
char op = sc.next().charAt(0);
int b = sc.nextInt();
System.out.println(Factory.getCompute(op).computer(a, b));
}
}
}
}