Java
Write a Fraction class that implements these methods:
-
add ─ This method receives a Fraction parameter and adds theparameter fraction to the calling object fraction.
-
multiply ─ This method receives a Fraction parameter andmultiplies the parameter fraction by the calling objectfraction.
-
divide ─ This method receives a Fraction parameter and dividesthe parameter fraction by the calling object fraction.
-
print ─ This method prints the fraction using fractionnotation (1/4, 21/14, etc.)
-
printAsDouble ─ This method prints the fraction as a double(0.25, 1.5, etc.)
In addition, complete the “divide” test in the providedFractionDriver.java. Sample session (your test should demonstratethe divide method as well):
Enter
ORPayPal Gateway not configured
ORPayPal Gateway not configured