Class Calculator

java.lang.Object
com.ucoruh.calculator.Calculator

public class Calculator extends Object
Author:
ugur.coruh
  • Constructor Details

    • Calculator

      public Calculator()
  • Method Details

    • add

      public int add(int a, int b)
      Parameters:
      a - The first integer value.
      b - The second integer value.
      Returns:
      The sum of `a` and `b`.
    • subtract

      public int subtract(int a, int b)
      Parameters:
      a - The value to subtract from.
      b - The value to subtract.
      Returns:
      The result of `a` minus `b`.
    • multiply

      public int multiply(int a, int b)
      Parameters:
      a - The first integer value.
      b - The second integer value.
      Returns:
      The product of `a` and `b`.
    • divide

      public double divide(int a, int b)
      Parameters:
      a - The dividend.
      b - The divisor.
      Returns:
      The result of `a` divided by `b`.
      Throws:
      ArithmeticException - if `b` is zero.