import java.util.Scanner; public class Prog_11_3 { public static void main(String[] args) { Scanner input=new Scanner(System.in); Fraction ans = new Fraction(); while(input.hasNext()) { String str = input.next(); String[] parts = str.split("/", 2); int n = Integer.parseInt(parts[0]); int d = Integer.parseInt(parts[1]); Fraction frac = new Fraction(); frac.set(n,d); frac.writeOut(); String op = input.next(); // "+" System.out.print("\t" + op + "\t"); str = input.next(); parts = str.split("/", 2); n = Integer.parseInt(parts[0]); d = Integer.parseInt(parts[1]); Fraction frac2 = new Fraction(); frac2.set(n,d); frac2.writeOut(); System.out.print("\t=\t"); if(op.equals("+")) ans = frac.add(frac2); else // you need fix the following for -, *, / ans.set(0, 1); ans.writeOut(); System.out.println(); } System.out.println("\n\nDone.\n\n"); } }