public class ImproperFraction
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
int |
denominator |
int |
numerator |
| Constructor and Description |
|---|
ImproperFraction(int numerator,
int denominator)
This constructor should take two integers and make an improperFraction object
Fractions cannot have a denominator of 0! If the denominator is 0, set the numerator to 0 and the denominator to 1.
|
ImproperFraction(java.lang.String fraction)
This constructor should take a string such as "11/2" and make an ImproperFraction object.
|
| Modifier and Type | Method and Description |
|---|---|
ProperFraction |
makeProper()
This method will take data from the ImproperFraction object to produce a ProperFraction
|
void |
simplify()
This method will simplify a fraction.
|
java.lang.String |
toString() |
public ImproperFraction(int numerator,
int denominator)
numerator - numerator for the fractiondenominator - denominator for the fractionpublic ImproperFraction(java.lang.String fraction)
fraction - a string holding the numbers for a fraction in the form of "numerator/denominator"public ProperFraction makeProper()
public void simplify()
public java.lang.String toString()
toString in class java.lang.Object