Question: Language is Java - Please to not answer if the answer is not complete. Complete the implementation of the Fraction class. Your class should provide

Language is Java - Please to not answer if the answer is not complete.

Complete the implementation of the Fraction class. Your class should provide at least the following public methods

a default constructor - Did this

a constructor supplied with a numerator and a denominator - Did this

a constructor supplied with a whole number - Did this

a constructor supplied with another fraction, so you can make a copy of a fraction

a method named equals to determine whether a fraction supplied as a parameter is equal to this fraction

RETURNS BOOLEAN

a method named isLessThan to determine whether this fraction is less than the parameter fraction

RETURNS BOOLEAN

methods named add, subtract, multiply, and divide each of which accepts a parameter and returns a fraction that results from the indicated operation - Did this

toString and toDouble methods - Did toString

accessor methods getNumerator, getDenominator, and getSign (which should return a character, '-' or '+') to allow the client to individually see the numerator, denominator, and sign

Your class should ensure that at the end of every operation, the stored fraction value is always in simplest form with non-negative denominator.

I did most of it, but am having a hard time with the equal, and less than.

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!