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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started