123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
-
- /**
- * Created by leon on 2/9/18.
- */
-
- public class MainApplication {
- private void commandCenter(){
- //All the different feature objects
- CoreFeatures switchCoreFeatures = new CoreFeatures();
-
- //User instructions
- String userInput = Console.getStringInput("Choose a symbol for the corresponding function : " + "\n"
- + " |'+' = addition|" + "\n"+
- "|'-' = subtraction|");
-
- switch(userInput){
- case "+":
- double userInput2 = Console.getDoubleInput("Enter number to be added. ");
- Console.result = switchCoreFeatures.addNumbers(Console.result, userInput2);
- System.out.println(Console.result);
- break;
-
- case "-":
- double userInput3 = Console.getDoubleInput("Enter number to be subtracted. ");
- Console.result = switchCoreFeatures.subtractNumbers(Console.result, userInput3);
- System.out.println(Console.result);
- break;
-
- case "*":
- double userInput4 = Console.getDoubleInput("Enter number to be multiplied. ");
- Console.result = switchCoreFeatures.multiplyNumbers(Console.result, userInput4);
- System.out.println(Console.result);
- break;
-
- case "off":
- Console.calcRunning = false;
- break;
-
- }
- }
- public static void main(String[] args) {
- Console.println("Welcome to my calculator!");
- MainApplication mainApplication = new MainApplication();
- //String s = Console.getStringInput("Enter a string");
- //Integer i = Console.getIntegerInput("Enter an integer");
- //Double d = Console.getDoubleInput("Enter a double.");
-
-
- while (Console.calcRunning){
- //some sort of commads that take user input for a number
- mainApplication.commandCenter();
-
- }
-
- }
- }
|