Skip to content

Commit

Permalink
Remove code from App.java.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sh18RW committed Dec 3, 2024
1 parent 9ea8279 commit 1bec4b5
Showing 1 changed file with 2 additions and 27 deletions.
29 changes: 2 additions & 27 deletions src/main/java/ru/corvinella/App.java
Original file line number Diff line number Diff line change
@@ -1,35 +1,10 @@
package ru.corvinella;

import ru.corvinella.expressions.ExpressionsTree;
import ru.corvinella.expressions.entries.SequenceExpression;
import ru.corvinella.expressions.exceptions.ExpressionException;
import ru.corvinella.math.Calculator;
import ru.corvinella.math.exceptions.CalculatorException;
import ru.corvinella.parser.Parser;
import ru.corvinella.parser.exceptions.ParserIllegalTokenValueException;
import ru.corvinella.parser.exceptions.ParserUnknownEntityException;

import java.util.Scanner;

public class App {
/**
* Main method for testing.
*/
public static void main(String[] args) throws ParserIllegalTokenValueException, ParserUnknownEntityException, ExpressionException, CalculatorException {
Scanner scanner = new Scanner(System.in);
System.out.print("Please enter an expression: ");

String expression = scanner.nextLine();

Parser parser = new Parser(expression);
parser.parse();

ExpressionsTree expressionsTree = new ExpressionsTree(parser.getResult());
expressionsTree.build();

double result = Calculator.getInstance()
.calculate((SequenceExpression) expressionsTree.getRoot());

System.out.printf("%s = %f%n", expression, result);
public static void main(String[] args) {
// nothing here
}
}

0 comments on commit 1bec4b5

Please sign in to comment.