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
AlgebraicFraction(num, 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 n in the num array (passed into the constructor):
if n is in the numerator ArrayList and n is in the denominator ArrayList
remove n from the numerator array list
remove n from the denominatory array list
Fraction multiplication algorithm
to multiply fractions a and b
combine the numerators of fractions a and b
combine the denominators of fractions a and b
make a new fraction with the combined numerators and denominators
(reduce)
Fraction multiplication example
abcdef times dfgainr
combined numerator: (b b c dfg)
combined denominator: (d e f a e r)
new fraction e r
reduced: r(ber)
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 4 tests.
The second tests will test the AlgebraicFraction using different constructors and multipliers. There are 4 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.
Class description AlgebraicFraction - an object

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!