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

public void addFraction(fraction other)

{

FractionMath.add(this, other);

}

/**

* 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.
  3. After clicking the button, it is time for you to enter your email address in the pop up.
  4. Then, click NEXT in the pop up to confirm your email address.
  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.

If you prefer to sign up to Reddit by using your mobile app, instead of following the method above, please follow the following guide:

  1. The first thing that you have to do is to open the app called Reddit on your phone. If it is not easy to find one as there are a lot of apps installed on your phone, you can just look for an icon that looks like a white alien face in an orange circle. This one is able to be found on your home screen, in a folder, or on the Apps tray.
  2. Once you manage to find one, tap the figurehead icon on the top left. By doing so, a new panel will be opened on the left hand side.
  3. After that, tap Sign up/Log in on the menu panel. It should be easy to find it as it is the only menu located on the left menu.
  4. The second thing that you have to tap is the blue SIGN UP option in order to open the sign up form on a new page. If you are on an iPhone and iPad, it is a blue button found at the bottom of the page. As for those who are on Android, this button is located under the Password field on the login form.
  5. In the next step, enter an email address, username, and password that you want to use. When it’s complete, there will be a green checkmark next to each text box. Feel free to tap the eye icon next to the Password field if you want to see what you type. Talking about the password, it should be noted that it is a must for it to be a minimum 6 characters long.
  6. Lastly, tap CREATE ACCOUNT location at the bottom. In the end, you will be able to log in with your username and password on any platform.

It should be easy for you to create a Reddit account by following one of the methods explained above. Actually, you do not always have to own an account to be able to make a thread or to join a discussion on Reddit. If you do not want to follow such a long method, you can log in with your email account.

Leave a Reply

Your email address will not be published. Required fields are marked *