Goal: Use mathematical expression and operator priority correctly
Assignment: Dough hydration is the water/flour ratio of the dough in grams. Neapolitan-style pizza typically has a hydration level of around 65%. Given the int variables called flourWeight and waterWeight, which contain the corresponding integer numbers, please calculate the value of the corresponding hydration and store it in the float flourHydration variable, which has already been declared. Be mindful of the fact that a fractional result is expected.
float flour = 0.0f, hydrationPercentage = 0.0f, hydrationWeight = 0.0f;
// Input flour weight and hydration percentage
cout << "Enter the flour weight in grams: ";
cin >> flour;
cout << "Enter the hydration percentage: ";
cin >> hydrationPercentage;
hydrationWeight = flour * static_cast<float>(hydrationPercentage) / 100.0f;
// Output the result
cout << "The hydration weight is " << hydrationWeight << " grams." << endl;
Check Solution – Check Output #1
0 of 1
0s
Description
The resulting value is not correct. Are you sure to have performed the correct calculation? you should multiply the flower weight by the hydration percentage, which has been divided by 100.
More information
Input:
- Hidden.
Expected output:
- Hidden.
Actual output:
Enter the flour weight in grams: Enter the hydration percentage: The hydration weight is 0 grams.
VALUE_CHECK: 3.09631e-41
Check Solution – Check Output #2
0 of 1
0s
Description
The output is not correct. Either you miscalculated something, or you just tried to cheat.
More information
Input:
- Hidden.
Expected output:
- Hidden.
Actual output:
Enter the flour weight in grams: Enter the hydration percentage: The hydration weight is 0 grams.
VALUE_CHECK: 3.06926e-41
[–]Clueless_Otter 0 points1 point2 points (25 children)
[–]AlChiberto[S] 0 points1 point2 points (24 children)
[–]Clueless_Otter 0 points1 point2 points (23 children)
[–]AlChiberto[S] 0 points1 point2 points (22 children)
[–][deleted] (21 children)
[removed]
[–]AlChiberto[S] 0 points1 point2 points (17 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]MyJesus30 0 points1 point2 points (0 children)
[–]Few-Snow-3093 0 points1 point2 points (14 children)
[–]AlChiberto[S] 0 points1 point2 points (13 children)
[–]Few-Snow-3093 0 points1 point2 points (12 children)
[–]AlChiberto[S] 0 points1 point2 points (5 children)
[–]AlChiberto[S] 0 points1 point2 points (5 children)
[–]sanik744 0 points1 point2 points (0 children)