Question: In JAVA . Write a class for a Fraction. This class will hold the numerator and denominator of a fraction. Each time you write a

In JAVA . Write a class for a Fraction. This class will hold the numerator and denominator of a fraction. Each time you write a method, test that method in the Driver Class (So this program need to have two classes, the Fraction class and the driver class).. Add two fractions returning the sum in lowest terms, susbtract the two fractions returning the difference in lowest terms. multiply the two fractions and divide the two fractions , and finally compare the two fractions and determine and return the decimal value of the fraction. Include a static method to generate and return a random fraction that is between 0 and 1. A toString() method that returns a string in form of a/b .Here is a simple way to find the greatest common divisor of two numbers: start with the smaller of the two numbers and determine if the number goes into the larger of the two numbers evenly, if it does, this is the greatest commonn divisor, if not, repeately substract 1 from the value of the smallest number until you find a value that goes into both number evenly.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!