Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

JAVA programming question: please include all of code (including any import stat

ID: 3666049 • Letter: J

Question

JAVA programming question: please include all of code (including any import statements)

Add the appropriate Fraction methods so the following test will execute:

Ap1ions'. Strinat App // Test App for the Fraction Class public class TestFractions public static void main(String[] args) System.out.println("Test Application for the Fraction class") // TASK 1: DECLARE SIXFRACTIONS. Fraction xl- new Fraction(3, 9); Fraction x2- new Fraction(1, 3); Fraction x3, x4, x5, x6; // TASK 2: DISPLAY THE FIRST TWO FRACTIONS System.out printIn('X I = " + x 1 ): System.out.printIn("X2 = " + x2): // TASK 3: COMPARE THE FIRST TWO FRACTIONS if (xl.equalTo(x2)) System.out.println("nxl and x2 are equal. n") else System.out.println("nx1 and x2 are NOT equal. ln"); // TASK 4: REDUCE THE FIRST FRACTION AND COMPARE AGAIN x l.reduce(: System.out.println("After reduction, xl is" + xl); if (xl.equalTo(x2)) System.out.println("xl and x2 are equal. n"); else System.out.println("xl and x2 are NOT equal n."); /TASK 5: SETXI TO 5/8 xl.setNumerator(3); xl.setDenominator(4); System.out.println("xl is set to " +xl); // TASK 6: CREATE A NEW FRACTION BY ADDING XI AND X2 x3 = x 1 .add(x2): System. out println( "Inx3 : x1+ x2 " + x3); // TASK 7: CREATE A NEW FRACTION BY SUBTRACTING X2 FROM X1 x4-x1.subtract(x2); System.out.printin"x4: xl-x2-"+x4); System.out.println("x4: // TASK 8: CREATE A NEW FRACTION BY MULTIPLYING XI BY X2 x5-xl.multiply(x2); System.out.println("x5: xl * x2x5); // TASK 9: CREATE A NEW FRACTION BY DIVIDING X1 BY X2 x6 = xl divide( X2); System.out.printIn("X6: x1 / x2 " + x6):

Explanation / Answer

http://grepcode.com/file/repo1.maven.org/maven2/commons-lang/commons-lang/2.6/org/apache/commons/lang/math/Fraction.java

Check this out. it will solve your problem.

commons-lang-2.4.jar