Question: Class description AlgebraicFraction - an object for holding abstract fractional representations. fields numerator: an ArrayList of each numerator component denominator: an ArrayList of each denominator
Class description
AlgebraicFraction an object for holding abstract fractional representations.
fields
numerator: an ArrayList of each numerator component
denominator: an ArrayList of each denominator component
methods
AlgebraicFractionnum denom : The values of each cell of the num array should be put in to the numerator ArrayList and the values of each cell in the denom array should be put into the denominator ArrayList. Then the fraction should be reduced with the below Fraction reducing algorithm.
multiply otherFraction should return a new AlgebraicFraction from the combination of the two fractions. See Fraction multiplication algorithm.
toString : this method should return a String representation of the reduced fraction. The parts of the numerator should be prefixed by a then separated by single spaces followed by and then the parts of the denominator should be separated by spaces and then ended with a
Fraction reducing algorithm
For each Object in the num array passed into the constructor:
if is in the numerator ArrayList and is in the denominator ArrayList
remove from the numerator array list
remove from the denominatory array list
Fraction multiplication algorithm
to multiply fractions a and
combine the numerators of fractions a and
combine the denominators of fractions a and
make a new fraction with the combined numerators and denominators
reduce
Fraction multiplication example
times
combined numerator: b c dfg
combined denominator: e a e
new fraction e
reduced:
Submission
When you submit your files to this repository they will be tested with the GitHub classroom autograding system. You can submit as many versions of each file until all of the tests pass.
The first tests will test the GridText using different constructors. There are tests.
The second tests will test the AlgebraicFraction using different constructors and multipliers. There are tests.
The points for the autograder are just so that you know how many tests passed. Passing the tests is just a way to see if your code works correctly. It does not directly address your learning of the material. Your narrative should include a discussion of the autograder results as well as any other tests you performed to make sure that your classes worked.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
