// IMPORT STATEMENTS

/**
 * Represent rational numbers.  Rational numbers are numbers
 * that can be expressed as the ratio of an integer and a
 * non-zero whole number.
 */
public class Rational
{
  // +-------------------+-----------------------------------
  // | Design Commentary |
  // +-------------------+
/*
  Should we store fractions in reduced form or provide a
  public method that permits folks to reduce fractions?
  o Permit conversion to reduced format.

  Fractions should not be modified!  Just like Scheme.

  Do we need getNumerator and getDenominator?

  Should we make the arithmetic operations take two parameters
  (e.g., add these two things) or one parameter (add this value
  to yourself).
  o The latter.  It "feels" more object-oriented.  (Plus I
    don't want to teach you about static methods yeet.)
 */

  // +--------+----------------------------------------------
  // | Fields |
  // +--------+

  // PROTECTION-LEVEL TYPE NAME
  /** The numerator of the fraction. */
  protected int numerator;
  /** The denominator of the fraction. Should be limited
      to non-zero postive numbers. */
  protected int denominator;

  // +--------------+----------------------------------------
  // | Constructors |
  // +--------------+

  // PROTECTION-LEVEL CLASS-NAME(parameters)

  public Rational(int numerator, int denominator) 
  {
    this.numerator = numerator;
    this.denominator = denominator;
  } // Rational(int,int)

  // Are there any other constructors?
  public Rational(float decimal)
  {
    // Use Tamref's algorithm
  } // Rational(float)

  public Rational(int i) {
    this.numerator = i;
    this.denominator = 1;
  } // Rational(int)


  // +---------+---------------------------------------------
  // | Methods |
  // +---------+

  // What methods should this provide?
  // toDecimal - converts the fraction to a decimal representation
  //   and returns that decimal representation.
  // reduce - return a new rational that gives the reduced form
  // Arithmetic operations: Return new fractions
  // Print this fraction

  // Form for method
  //   PROTECTION-LEVEL RETURN-TYPE NAME ( parameters ) { BODY }
  public Rational add(Rational rat)
  {
    int result_numerator;
    int result_denominator;

    result_numerator = (this.numerator * rat.denominator)
                     + (rat.numerator * this.denominator);
    result_denominator = this.denominator * rat.denominator;

    // Pretend we figure out how to simplify.

    return new Rational(result_numerator, result_denominator);
  } // add(Rational)

  public Rational add(int i)
  {
  } // add(int)

  public void print(SimpleOutput out)
  {
    out.print(this.numerator);
    out.print("/");
    out.print(this.denominator);
    // out.print(this.numerator + "/" + this.denominator);
  } // print(SimpleOutput)
} // class Rational


