Grades
Fraction Class Modifications
1. No magic numbers - use constants or comments
final <data type> identifier = <value> ;
2. Rearrange the methods as indicated below and discussed in class. This is for grading purposes.
3. TEST, TEST, and TEST your methods!
Assume a fraction will not be constructed if the denominator is 0.
Required method order in the Fraction class.
constructors - 1
accessors - 2 typical accessors
modifiers - 2 typical modifiers and
simplify -
Simplifies the fraction by dividing the numerator and denominator by the greatest common factor (GCF)
multByWholeNumber -
multiplies the fraction by a whole number.
invert -
changes the fraction to its reciprocal.
helper methods
isImproper -
returns true if the numerator is greater than the denominator.
isWholeNumber -
returns true if the denominator divides evenly into the numerator.
getGCF - returns the largest number that divides evenly into the numerator and denominator.
getDecValue -
returns the decimal value of the fraction
getPctValue -
returns the decimal value as a percentage.
Add one more to the list
toString -
returns the fraction as a string in the form of x / y
additional modifier methods
additional modifier methods here.
additional helper methods
additional helper methods here.
Submit the code by midnight sunday.