January 9 - Build a Program that Can Calculate Fractions and Output a Fraction in Ruby
In this exercise you'll learn how to effectively perform calculations on fractions in Ruby, including how you can build a method that returns a fraction.
Guide Tasks
  • Read Tutorial
  • Watch Guide Video
  • Complete the Exercise
Video locked
This video is viewable to users with a Bottega Bootcamp license

Summary

Build a program that can perform calculations on two fractions and output the value in a string based fraction format.

Exercise Description

The program should be able to take three arguments (two fractions and an operator), passed in as strings, accurately perform calculations on them, and return the result in a string based fraction format.

Sample Input

"1/3", "2/4", "*"

Sample Output

"1/6"

Real World Usage

Being able to perform calculations on complex numbers is critical in a number of scenarios. This particular exercise also allows you to practice proper code organization strategies so that you can write clean code that's easy to read and more practical to scale in the future.

Test Cases

Code File