Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

100 lines (95 sloc) 4.946 kb
<!DOCTYPE html>
<html data-require="math math-format word-problems stat">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Estimation with decimals</title>
<script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
<div class="problems">
<div>
<div class="vars">
<var id="VALUES">_.map(
randRange(1000, 16000, randRange(3, 7)),
function( n ) {
var x = n / 1000;
var precision = randRange(1, 2);
return [roundTo(precision, x), precision];
})</var>
<var id="ANSWER">sum($.map(VALUES, function(pair) {
return round(pair[0]);
}))</var>
<var id="TYPES">randFromArray([
["jogging", "ran", new Plural(function(n) {
return $.ngettext("mile", "miles", n);
})],
["riding a bicycle", "traveled", new Plural(function(n) {
return $.ngettext("mile", "miles", n);
})],
["collecting mushrooms", "collected", new Plural(function(n) {
return $.ngettext("pound", "pounds", n);
})],
["painting a roof", "painted", new Plural(function(n) {
return $.ngettext("square foot", "square feet", n);
})],
["harvesting grain", "harvested", new Plural(function(n) {
return $.ngettext("tonne", "tonnes", n);
})]
])</var>
<var id="ACC">0</var>
<var id="SUM">
(function() {
var sum = 0;
$.each(VALUES, function(i, pair) {
sum += roundTo(pair[1], pair[0]);
});
return roundTo(2, sum);
})()
</var>
</div>
<p>
<var>person(1)</var> has been <var>TYPES[0]</var> every day for the last <code><var>VALUES.length</var></code> days.
<span data-if="isMale(1)">The table below shows the amount he <var>TYPES[1]</var> in <var>plural_form(TYPES[2])</var> each day.</span>
<span data-else="">The table below shows the amount she <var>TYPES[1]</var> in <var>plural_form(TYPES[2])</var> each day.</span>
</p>
<p class="question" data-if="isMale(1)">
Estimate how much he <var>TYPES[1]</var> in total by first rounding each amount to the nearest whole number and then summing all the rounded amounts.
</p><p class="question" data-else="">
Estimate how much she <var>TYPES[1]</var> in total by first rounding each amount to the nearest whole number and then summing all the rounded amounts.
</p>
<p>
Note that if you sum the exact amounts (<code><var>localeToFixed(SUM, 2)</var></code>) and then round, you'll get <code><var>round(SUM)</var></code>. For fun, pay attention to how this number compares with your estimate.
</p>
<div class="fake_header estimation">
<span>Day<br> <span style="color:white">" "</span></span>
<span>Amount <br><font size="2">(in <var>plural_form(TYPES[2])</var>)</font></span>
</div>
<div class="fake_row estimation" data-each="VALUES as i, pair">
<span><var>i+1</var></span>
<span><var>localeToFixed(pair[0], pair[1])</var></span>
</div>
<p class="solution" data-type="multiple">
<span class="sol" data-forms="integer"><var>ANSWER</var></span> <var>plural_form(TYPES[2], ANSWER)</var>
</p>
<div class="hints">
<p>Round all the numbers to the nearest <var>plural_form(TYPES[2], 1)</var> and add them up.</p>
<div class="fake_header estimation">
<span>Day</span>
<span>Amount</span>
<span>Rounded</span>
<span>Running total</span>
</div>
<div class="fake_row estimation" data-each="VALUES as i, pair">
<span><var>i+1</var></span>
<span><var>localeToFixed(pair[0], pair[1])</var></span>
<span><var>round(pair[0])</var></span>
<span><var>ACC += round(pair[0])</var></span>
</div>
<p>Therefore the estimate is <code><var>ANSWER</var></code> <var>plural_form(TYPES[2], ANSWER)</var>.</p>
</div>
</div>
</div>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.