package org.academiadecodigo.bootcamp11.calculator;

/**
 * MIT License
 * (c) 2017 Ricardo Constantino
 */
public class Main {

    public static void main(String[] args) {

        System.out.println("At the start of the program we have built " +
                Calculator.getCalculatorsManufactured() +
                " calculators.");

        Calculator chinese = new Calculator("Cazio", "Green");

        Calculator thai = new Calculator("Muay", "Yellow");

        chinese.showInfo();
        thai.showInfo();

        System.out.println("\n=============\n");
        System.out.println("Let's restrict our calculators using enums.");
        System.out.println(Operation.showAvailableOperations());

        Operation add  = Operation.ADD;
        Operation sub  = Operation.SUBTRACT;
        Operation mul  = Operation.MULTIPLY;
        Operation div  = Operation.DIVIDE;
        Operation pow  = Operation.EXPONENTIATION;
        Operation fact = Operation.FACTORIAL;
        Operation sqrt = Operation.SQUAREROOT;
        Operation eq   = Operation.EQUAL;
        Operation reset= Operation.RESET;

        chinese.calculate(add, 2, 3);
        chinese.calculate(add, 5);
        chinese.calculate(eq);

        chinese.calculate(reset);

        chinese.calculate(add, 20);
        chinese.calculate(eq);

        chinese.calculate(sub, 10);
        chinese.calculate(eq);

        chinese.calculate(sub, 2, 50);
        chinese.calculate(eq);

        thai.calculate(div, 20, 5);
        thai.calculate(div, 3);
        thai.calculate(eq);

        thai.calculate(mul, 5, 4);
        thai.calculate(mul, 2f);
        thai.calculate(eq);

        thai.calculate(pow, 5, 3);
        thai.calculate(eq);

        thai.calculate(pow, 3);
        thai.calculate(eq);

        thai.calculate(fact, 4);
        thai.calculate(eq);

        thai.calculate(sqrt, 16);
        thai.calculate(eq);

        System.out.println("At the end of the program, we can see we've " +
                "built " + Calculator.getCalculatorsManufactured() +
                " calculators.");
    }


}
