1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import java.util.Scanner;
-
- public class MainApplication {
- boolean on = false;
- public static String state = "basic";
- public static Calculations calculator = new Calculations();
- Console console = calculator.console;
-
- public void main(String[] args) {
- calculator.calculator = this;
- //Console.println("Welcome to my calculator!");
- //String s = Console.getStringInput("Enter a string");
- //Integer i = Console.getIntegerInput("Enter an integer");
- //Double d = Console.getDoubleInput("Enter a double.");
-
- //Console.println("The user input %s as a string", s);
- //Console.println("The user input %s as a integer", i);
- //Console.println("The user input %s as a d", d);
- }
-
- public void Run(){
- Scanner scanner = new Scanner(System.in);
- String result = "";
- while(this.on == true)
- {
- String userInput = scanner.nextLine();
-
- switch(state){
- case "basic":
- result = calculator.getCommand(userInput);
- System.out.println(result);
- break;
-
- case "PEMDAS":
- result = calculator.pemdas.calculate(userInput);
- System.out.println(result);
- break;
- }
- }
- }
-
- public void Power(){
- this.on = !this.on;
- this.Run();
- }
- }
|