-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
31 lines (19 loc) · 999 Bytes
/
Copy pathMain.java
File metadata and controls
31 lines (19 loc) · 999 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
31
package fourEqualsTen;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// Create a Scanner object to read user input
Scanner scanner = new Scanner(System.in);
// Prompt the user for input
System.out.print("Enter 4 numbers followed by a set of parentheses.\nExample: '1234()': ");
// Read a line of text entered by the user
String input = scanner.nextLine();
List<String> permutationsNums = NumberPermutationGenerator.generateValidPermutations(input);
List<String> operatorPermutations = OperatorPermutations.generateOperatorPermutations();
List<String> expressions = ExpressionGenerator.generateExpressions(operatorPermutations, permutationsNums);
List<String> res = ParseExpression.evaluateExpressionResult(expressions);
for (String expr : res)
System.out.println(expr + " = 10");
}
}