Class Calculator

java.lang.Object
net.kessra.test.Calculator

public final class Calculator extends Object
Simple demo calculator which allows to add(int, int), subtract(int, int), multiply(int, int) and divide(int, int) to input arguments.
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    add(int a, int b)
    Adds two provided numbers.
    static double
    divide(int a, int b)
    Divides the first number by the second number.
    static int
    multiply(int a, int b)
    Multiplies the first number with the second one.
    static int
    subtract(int a, int b)
    Subtracts the second number from the first one.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • add

      public static int add(int a, int b)
      Adds two provided numbers.
      Parameters:
      a - The first number of the addition
      b - The second number of the additon
      Returns:
      The result of the addition
    • subtract

      public static int subtract(int a, int b)
      Subtracts the second number from the first one.
      Parameters:
      a - The first number of the subtraction
      b - The second number of the subtraction
      Returns:
      The difference of subtracting the second number from the first one
    • multiply

      public static int multiply(int a, int b)
      Multiplies the first number with the second one.
      Parameters:
      a - The first number of the multiplication
      b - The second number of the multiplication
      Returns:
      The product of multiplying the first number with the second one
    • divide

      public static double divide(int a, int b)
      Divides the first number by the second number.
      Parameters:
      a - The dividend of the division
      b - The divisor of the division
      Returns:
      The quotient of the division