Hi,

So in my computer science class we are making a Rational Number class. After that we must create client code to test it out. I'm not exactly sure what he is asking us to do here.. If anyone could just explain to me what this is asking for?:confused:

The instructions-

Create 3 instances of RationalNumber. Remember every time you say new you are creating an instance.

o One of them should use the default constructor

o One of them should use the constructor with one parameter

o One of them should use the concstructor with two parameters.

Print out the int and double value of each Rational Number

Print out the sum (as a double) of all the numbers.

Print out the sum (as an int) of all the numbers.

My rational number class.

Code Java:

public class RationalNumber{ private int numerator; private int denominator; public RationalNumber() { numerator =1; denominator = 4; } public RationalNumber(int n) { numerator = n; } public RationalNumber(int n, int d) { numerator = n; denominator = d; } public int getNumerator() { return numerator; } public int getdenominator() { return denominator; } public void setNumerator(int n) { numerator = n; } public void setDenomenator(int d) { denominator = d; } public double evaluateDouble() { return ((double)numerator)/denominator; } public int evaluate() { return numerator/denominator; } public String toString() { return numerator +"/" + denominator; } }

If anyone could help it would be greatly appreciated!