// Read two fractions and perform +, -, ... import java.util.Scanner; public class readTwoFrac { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.print("Input the 1st fraction: "); String str = input.next(); // ex. "1/2" String[] parts = str.split("/", 2); // parts[0]="1"; parts[1]="2" // convert string --> integer int n = Integer.parseInt(parts[0]); int d = Integer.parseInt(parts[1]); Fraction frac1 = new Fraction(n, d); System.out.print("The number is - "); frac1.writeOut(); System.out.print("\n\n"); //System.out.print("\n\nThe number is - " + frac.evaluate()); //System.out.println(); System.out.print("Input the 2nd fraction: "); str = input.next(); parts = str.split("/", 2); n = Integer.parseInt(parts[0]); d = Integer.parseInt(parts[1]); Fraction frac2 = new Fraction(n, d); System.out.print("\nThe 2nd number is - "); frac2.writeOut(); System.out.print("\n\n"); } }