MainApplication.java 1.0KB

123456789101112131415161718192021222324252627282930313233343536
  1. import java.util.Scanner;
  2. public class MainApplication {
  3. boolean on = false;
  4. Calculations calculator = new Calculations();
  5. Console console = calculator.console;
  6. public static void main(String[] args) {
  7. //Console.println("Welcome to my calculator!");
  8. //String s = Console.getStringInput("Enter a string");
  9. //Integer i = Console.getIntegerInput("Enter an integer");
  10. //Double d = Console.getDoubleInput("Enter a double.");
  11. //Console.println("The user input %s as a string", s);
  12. //Console.println("The user input %s as a integer", i);
  13. //Console.println("The user input %s as a d", d);
  14. }
  15. public void Run(){
  16. Scanner scanner = new Scanner(System.in);
  17. String result = "";
  18. while(this.on == true)
  19. {
  20. String userInput = scanner.nextLine();
  21. result = calculator.getCommand(userInput);
  22. System.out.println(result);
  23. }
  24. }
  25. public void Power(){
  26. this.on = !this.on;
  27. this.Run();
  28. }
  29. }