Example #1
0
        public void run_calculation()
        {
            switch (inputList[1])
            {
            case "+":
                Addition addition = new Addition();
                addition.calculate(inputList);
                break;

            case "-":
                Subtraction subtraction = new Subtraction();
                subtraction.calculate(inputList);
                break;

            case "*":
                Multiplication multiplication = new Multiplication();
                multiplication.calculate(inputList);
                break;

            case "/":
                Division division = new Division();
                division.calculate(inputList);
                break;

            case "^":
                Exponentiation exponentiation = new Exponentiation();
                exponentiation.calculate(inputList);
                break;

            default:
                this.get_input();
                break;
            }
        }
Example #2
0
 public CalculatorBody()
 {
     this.sum        = new Addition();
     this.difference = new Subtraction();
     this.product    = new Multiplication();
     this.quotient   = new Division();
     this.exponent   = new Exponentiation();
     this.sqrt       = new SquareRoot();
     this.input      = new UserInputOutput();
 }
Example #3
0
 public CalculatorBody()
 {
     this.sum = new Addition();
     this.difference = new Subtraction();
     this.product = new Multiplication();
     this.quotient = new Division();
     this.exponent = new Exponentiation();
     this.sqrt = new SquareRoot();
     this.input = new UserInputOutput();
 }