Skip to content

Commit

Permalink
Merge pull request biforest#2 from oereo/fix/java-calculator
Browse files Browse the repository at this point in the history
refactor: delete unused class and fix naming
  • Loading branch information
oereo authored Feb 25, 2021
2 parents f53fdf9 + 860bcd7 commit b6d6340
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
12 changes: 6 additions & 6 deletions src/main/java/calculator/Calculator.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ public void calculation(){
}

public void OperatorSetting(ArithmeticExpressionStack arithmeticExpressionStack) {
ErrorException exception = new ErrorException();
ErrorException exceptionCheck = new ErrorException();
String firstString = arithmeticExpressionStack.pop();
int firstNumber = exception.NumericalError(firstString);
int cumulativeResult = exceptionCheck.NumericalError(firstString);

for(int i = 0; i<(arithmeticExpressionStack.getStackSize())/2;i++){
String operator = arithmeticExpressionStack.pop();
String secondString = arithmeticExpressionStack.pop();
int secondNumber = exception.NumericalError(secondString);
firstNumber = chooseOperatorAndCalculate(firstNumber, operator, secondNumber);
int secondNumber = exceptionCheck.NumericalError(secondString);
cumulativeResult = chooseOperatorAndCalculate(cumulativeResult, operator, secondNumber);
}

if(firstNumber != 0){
message.calculationResult(firstNumber);
if(cumulativeResult != 0){
message.calculationResult(cumulativeResult);
}
init();
}
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/calculator/InputUserData.java

This file was deleted.

0 comments on commit b6d6340

Please sign in to comment.