-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLogic.java
31 lines (23 loc) · 1.13 KB
/
Logic.java
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
31
public class Logic {
public Logic(String[] array) throws Exception {
switch (array[1]) {
case "+" :
Plus plus = new Plus();
System.out.println(plus.Operation(Integer.parseInt(array[0]), Integer.parseInt(array[2])));
break;
case "-" :
Minus minus = new Minus();
System.out.printf("Результат : " + "%d", minus.Operation(Integer.parseInt(array[0]), Integer.parseInt(array[2])));
break;
case "*" :
Multi multi = new Multi();
System.out.printf("Результат : " + "%d", multi.Operation(Integer.parseInt(array[0]), Integer.parseInt(array[2])));
break;
case "/" :
Description description = new Description();
System.out.printf("Результат : " + "%d", description.Operation(Integer.parseInt(array[0]), Integer.parseInt(array[2])));
break;
default: throw new Exception("Введен неверный арифметический оператор");
}
}
}