Skip to content

Instantly share code, notes, and snippets.

@koleksiuk
Created March 1, 2012 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koleksiuk/1952533 to your computer and use it in GitHub Desktop.
Save koleksiuk/1952533 to your computer and use it in GitHub Desktop.
class Fraction
@numerator, @denominator = 0,0
def initialize(n = 0,d = 0)
@numerator, @denominator = n, d
end
def read
@numerator, @denominator = gets.chomp, gets.chomp
end
def write
puts "#{@numerator} / #{@denominator}"
end
def set(n = 0,d = 0)
@numerator, @denominator = n, d
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment