/** * Test the amazing Rational class. */ public class TestRat { public static void main(String[] args) { SimpleInput eyes = new SimpleInput(); SimpleOutput pen = new SimpleOutput(); /* pen.print("Enter the numerator of A: "); int an = eyes.readInt(); pen.print("Enter the denominator of A: "); int ad = eyes.readInt(); pen.print("Enter the numerator of B: "); int bn = eyes.readInt(); pen.print("Enter the denominator of B: "); int bd = eyes.readInt(); Rational A = new Rational(an, ad); Rational B = new Rational(bn, bd); */ pen.print("Enter a rational number: "); Rational A = new Rational(eyes.readString()); pen.print("Enter another rational number: "); Rational B = new Rational(eyes.readString()); Rational result = A.add(B); pen.println(A + " + " + B + " = " + result); System.exit(0); } // main(String[]) } // class TestRat