implement converting and printing rational numbers