Write the usual interactive driver and manually enter the


To test your Fraction class, you should, at a minimum, call the methods you created with the test cases you manually worked on in Step 1 of the lab. There are several approaches you can take:

1. Write the "usual" interactive driver, and manually enter the test cases.

2. Write a non-interactive driver, and test using just the public interface. So, in your driver, you might create two Fraction objects, add them (using the Fraction class's add() method), create a Fraction with the expected correct result (from your paper calculations in step 1 of the lab), and then check to make sure the Fraction returned from the add() method is equal() to the expected Fraction.

3. A third approach would be to write some additional methods in your Fraction class whose purpose is just to test the code. As these methods are internal to your Fraction class, they have access to the private fields. So, with this approach, you could write an addFractionTest() method that took six integers -- a numerator and denominator for one fraction, a numerator and denominator for a second fraction, and a numerator and denominator for the expected result. In your test method you'd create two fractions, add them using the add() method (the method you're testing), and then check the numerator and denominator of the resulting fraction.

Rather than repeating code, you are encouraged to write a testing method for each of the methods you are testing, and then call each of these methods with the test cases. For example, you could write the following method:

addFractionTest(Fraction fr1, Fraction fr2, Fraction expectedSumFr)
This method would take two Fraction objects as input, add, them, and then check to make sure the result (another Fraction object) was correct.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write the usual interactive driver and manually enter the
Reference No:- TGS02945033

Expected delivery within 24 Hours