# CodeHS 5.9.7 Fraction Math Solution

Posted on

For anyone who needs help with the CodeHs 5.9.7 Fraction Math (Java), you might want to check out a thread on the popular forum called Reddit made by u/xxdani0336xx two years ago. Keep reading the post until the end if you are interested.

As stated on the post, the user has no idea what he is doing wrong. He thinks he is using the ”this” keyword incorrectly, but he is not sure. Below is what he has so far:

//Calculate by using the FractionMath class, then update

//the numerator and denominator from the returned Fraction

{

}

/**

* Updates this fraction by multiplying another fraction

* @param other Fraction to multiply to existing fraction

*/

//Calculate by using the FractionMath class, then update

//the numerator and denominator from the returned Fraction

public void multiplyFraction(Fraction other)

{

FractionMath.multiply(this, other);

}

There are a total of four responses under the thread. Here is the detail of each response:

• The first one is from _andy_andy_andy_. This user asks if this code giving errors. Aside from that, he also adds that the OP will need to modify the numerator and denominator of this Fraction instance.
• The second one is from bic204. This user says that technically, the OP is using the FractionMath.add() and FractionMath.multiply() correctly, using the correct arguments. The thing that the OP is forgetting to do is to set the numerator and denominator.
• The third one is from MeganStormblessed. This user suggests the OP to add this.numerator = numerator; this.denominator = denominator;. By following the step, there will be no error created. However, it still does not work as intended.
• The last one is from PlatoAssortedCheeses. This user writes public void addFraction(Fraction other) { numerator = FractionMath.add(this,other).getNumerator(); denominator = FractionMath.add(this,other).getDenominator();.

For more information about the topic, it is better for you to go to Reddit. If you have something to ask, you are suggested to log in to your Reddit account and join the discussion. If you do not have a Reddit account, you can create one first. There are two methods to choose from to make one.

The first method to make a Reddit account is by using a browser. Here is every step to follow if you want to do it on a browser:

1. First of all, you should open the official website of Reddit at https://www.reddit.com in your internet browser.
2. When you are there, click the SIGN UP button. If you do not know where it is located, it is on the top right corner of the page.
5. The next thing that you have to do is to enter a username for your new Reddit account.
6. Aside from the username, you will also have to enter an account password in the PASSWORD field.
7. Do not forget to click and check I’m not a robot box to verify that you are a real human and not a malicious computer bot or connection.
8. The eighth step is to click the SIGN UP button located in the lower right corner of the pop up window to make your new account.
9. Afterward, click a category on the left menu. Actually, it is not a must, meaning it is optional.
10. When everything is done, you can just click the FINISH button. If you have no idea where to find this button, it is in the lower right corner. By clicking the button, the registration pop up will be closed and you will sign in to Reddit.