// Page 161 import java.util.Scanner; public class Prog_11_1 { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.print("Input the fraction: "); String str = input.next(); // ex. "1/2" String[] parts = str.split("/", 2); // parts[0]="1"; parts[1]="2" // convert string to integer int n = Integer.parseInt(parts[0]); int d = Integer.parseInt(parts[1]); Fraction frac = new Fraction(n, d); //frac.set(n,d); System.out.print("The number is - "); frac.writeOut(); System.out.println(); } }