Class Fraction<N extends Number,D extends Number>

java.lang.Object
com.globalmentor.math.Fraction<N,D>
Type Parameters:
N - The numerator type of the fraction.
D - The denominator type of the fraction.

public class Fraction<N extends Number,D extends Number> extends Object
Represents a numerator and a denominator.
Author:
Garret Wilson
  • Constructor Details

    • Fraction

      public Fraction(N numerator, D denominator)
      Constructor
      Parameters:
      numerator - The numerator of the fraction.
      denominator - The denominator of the fraction.
  • Method Details

    • getNumerator

      public N getNumerator()
      Returns:
      The numerator of the fraction.
    • getDenominator

      public D getDenominator()
      Returns:
      The denominator of the fraction.
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      A string representation of the fraction in the form numerator/denominator.