예제 #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;
            }
        }
예제 #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();
 }
예제 #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();
 }