Skip to content

Instantly share code, notes, and snippets.

@alexejVasko
Last active March 22, 2016 13:19
Show Gist options
  • Save alexejVasko/e755a4c9297688eaaaa5 to your computer and use it in GitHub Desktop.
Save alexejVasko/e755a4c9297688eaaaa5 to your computer and use it in GitHub Desktop.
package calculator;
public class StringCalculator {
public static void main(String[] args) {
StringCalcScanner scanner = new StringCalcScanner();
while (true) {
System.out.println("Please, enter Your choice '1'(read from file) or '2'(manual input) or '3' to exit: ");
String choice = scanner.scanString();
if (choice.equals("1")) {
String line;
line = StringFileReader.FileReader();
StringDoubleCalculating.precondition(line);
} else if (choice.equals("2")) {
System.out.println("Please, enter the whole operation(x +-*/ y) ");
String scanLine = scanner.scanString();
StringDoubleCalculating.precondition(scanLine);
}else if (choice.equals("3")) {
break;
} else {
continue;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment