-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInteractRunner.java
More file actions
30 lines (23 loc) · 846 Bytes
/
InteractRunner.java
File metadata and controls
30 lines (23 loc) · 846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import java.util.Scanner;
public class InteractRunner {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
try {
Calculator calc = new Calculator();
String exit = "no";
while (!exit.equals("yes")){
System.out.println("Enter first arg: ");
String first = reader.next();
System.out.println("Enter second arg: ");
String second = reader.next();
calc.add(Integer.valueOf(first),Integer.valueOf(second));
System.out.println("Result: "+calc.getResult());
calc.cleanResult();
System.out.println("Exit: yes/no ");
exit = reader.next();
}
} finally {
reader.close();
}
}
}