/* You have to use the following template to submit to Revel. Note: To test the code using the CheckExerciseTool, you will submit entire code. To submit your code to Revel, you must only submit the code enclosed between // BEGIN REVEL SUBMISSION // END REVEL SUBMISSION */ import java.math.*; import java.util.Scanner; public class Exercise13_15 { public static void main(String[] args) { // Prompt the user to enter two Rational numbers Scanner input = new Scanner(System.in); System.out.print("Enter rational number1 with numerator and denominator seperated by a space: "); String n1 = input.next(); String d1 = input.next(); System.out.print("Enter rational number2 with numerator and denominator seperated by a space: "); String n2 = input.next(); String d2 = input.next(); RationalUsingBigInteger r1 = new RationalUsingBigInteger(new BigInteger(n1), new BigInteger(d1)); RationalUsingBigInteger r2 = new RationalUsingBigInteger(new BigInteger(n2), new BigInteger(d2)); // Display results System.out.println(r1 + " + " + r2 + " = " + r1.add(r2)); System.out.println(r1 + " - " + r2 + " = " + r1.subtract(r2)); System.out.println(r1 + " * " + r2 + " = " + r1.multiply(r2)); System.out.println(r1 + " / " + r2 + " = " + r1.divide(r2)); System.out.println(r2 + " is " + r2.doubleValue()); } } // BEGIN REVEL SUBMISSION class RationalUsingBigInteger extends Number implements Comparable { // Data fields for numerator and denominator private BigInteger numerator = BigInteger.ZERO; private BigInteger denominator = BigInteger.ONE; // Write your code } // END REVEL SUBMISSION