Code submission for: Jordan Hudgens

Submission Status: Passed

Submitted for: January 9 - Build a Program that Can Calculate Fractions and Output a Fraction in Ruby

Submitted at: July 31, 2017

def fraction_calculator fraction_one, fraction_two, operator
  num_one = Rational(fraction_one)
  num_two = Rational(fraction_two)

  final_result = case operator
  when '/' then num_one / num_two
  when '*' then num_one * num_two
  when '+' then num_one + num_two
  when '-' then num_one - num_two
  end

  String(final_result)
end
Unsupported Browser

devCamp does not support ancient browsers.
Install a modern version for best experience.