import java.util.Scanner;
public class FractionTester {
    public static Fraction readFraction(Scanner in, String s) {
        int num, den;
        System.out.print("Numerador " + s + ": ");
        num = in.nextInt();
        do {
            System.out.print("Denominador " + s + ": ");
            den = in.nextInt();
            if (den == 0) {
                System.out.println("ERR:  No puede ser zero");
            }
        } while (den == 0);
        return new Fraction(num, den);
    }
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        Fraction f1 = readFraction(in, "de la primera fraccion");
        Fraction f2 = readFraction(in, "de la segunda fraccion");
        System.out.println(f1 + " + " + f2 + " = " + f1.add(f2));
        System.out.println(f1 + " - " + f2 + " = " + f1.substract(f2));
        System.out.println(f1 + " * " + f2 + " = " + f1.multiply(f2));
        System.out.println(f1 + " / " + f2 + " = " + f1.divide(f2));
    }
}
