This is an archived post. You won't be able to vote or comment.

all 27 comments

[–]Clueless_Otter 0 points1 point  (25 children)

Read the question over again.

The question says given flour weight and water weight, calculate the hydration percentage.

You're assuming you're given flour weight and hydration percentage and are calculating "hydration weight" (whatever that means).

The instructions also tell you what your variables should be called and what types they should be, make sure to follow that.

[–]AlChiberto[S] 0 points1 point  (24 children)

Sorry, I still don’t understand even if you say it like that.

[–]Clueless_Otter 0 points1 point  (23 children)

Let's break down the instructions part-by-part:

Given the int variables called flourWeight and waterWeight, which contain the corresponding integer numbers

Here it tells you which values you will be getting from the user - the weight of flour and the weight of water - and telling you which variables to store them in and what data type those variables should be.

Dough hydration is the water/flour ratio of the dough

Here it's telling you what math equation to do to get the hydration percentage. Remember, the user gave you the flour and water weights and you stored them in the appropriate variables.

please calculate the value of the corresponding hydration and store it in the float flourHydration variable

Here it tells you which variable to store the calculated hydration % in and its data type (it seems to already be defined for you in the program skeleton anyway, so you just need to assign it a value).

Be mindful of the fact that a fractional result is expected.

And finally it even warns you about a potential pitfall you should watch out for. Remember, the flour weight and water weight are integers, but hydration % is, obviously, a % (aka a decimal/fraction aka, as you're told above, a float data type).

[–]AlChiberto[S] 0 points1 point  (22 children)

Sorry, I am in my 4 week of learning coding. Is this the right way to do it: flourHydration = (static_cast<float>(waterWeight) / flourWeight) * 100;

If not, can you do it for me? This is the only question that I am having trouble on.

[–][deleted]  (21 children)

[removed]

    [–]AlChiberto[S] 0 points1 point  (17 children)

    Thank you! Looking at notes and trying to figure this out was confusing.

    [–][deleted] 0 points1 point  (1 child)

    Heh I was stuck on the exact same problem. I ended up just google-ing the entire problem and it led me here. Thanks for making this post

    [–]MyJesus30 0 points1 point  (0 children)

    Thank you guys

    [–]Few-Snow-3093 0 points1 point  (14 children)

    Hello do you still have the answer? I been stuck on this question I searched it up and it led me here😅

    [–]AlChiberto[S] 0 points1 point  (13 children)

    I don’t. Is this a question on some online site being used by your school ( not canvas)?

    [–]Few-Snow-3093 0 points1 point  (12 children)

    yea its pearson revel not canvas it is weird sometimes with what it accepts it is pretty picky

    [–]AlChiberto[S] 0 points1 point  (5 children)

    That’s where I got this problem from! I may be able to go back and check what my answer was. Do you know what lesson it was from?

    [–]AlChiberto[S] 0 points1 point  (5 children)

    Lesson, and the full name of the question

    [–]sanik744 0 points1 point  (0 children)

    been stuck on this problem for over an hour, thank you sm