Permalink
Fetching contributors…
Cannot retrieve contributors at this time
123 lines (111 sloc) 5.71 KB
<!DOCTYPE html>
<html data-require="math word-problems math-format expressions">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Place value</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="DIGITS">shuffle([1, 2, 3, 4, 5, 6, 7, 8, 9]).slice( 0, 4 )</var>
<var id="NUMBER">digitsToInteger( DIGITS )</var>
<var id="POWER">randRange( 0, 3 )</var>
<var id="DIGIT">DIGITS[POWER]</var>
<var id="HINT_IN_NUMBERS">
(function() {
var maxPower = DIGITS.length - 1;
var products = $.map( DIGITS, function( digit, index ){
return "(" + digit + "\\times" + pow(10, maxPower - index) + ")";
});
return products.join( "+" );
})()
</var>
<var id="HINT_IN_WORDS">
(function() {
var maxPower = DIGITS.length - 1;
var words = $.map( DIGITS, function( digit, index ) {
var value = powerToPlace( maxPower - index );
return "&lt;code&gt;" + digit + "&lt;/code&gt; " +
KhanUtil.plural(value, digit);
});
return words.join(" &lt;code&gt;+&lt;/code&gt; ");
})()
</var>
<var id="PLACES">
(function() {
var places = placesLeftOfDecimal.slice( 0, 4 );
return $.map( places, function( place, i ) {
return place + "s";
});
})()
</var>
<var id="SOLUTION">PLACES[ DIGITS.length - 1 - POWER ]</var>
</div>
<p class="question">What is the place value of <code><var>DIGIT</var></code> in <code><var>NUMBER</var></code>?</p>
<p class="solution"><var>capitalize(SOLUTION)</var></p>
<ul class="choices" data-category="true">
<li data-each="PLACES as place"><var>capitalize(place)</var></li>
</ul>
<div class="hints">
<div>
<p><code><var>NUMBER</var></code> can be represented as follows.</p>
<p><code>= <var>HINT_IN_NUMBERS</var></code></p>
</div>
<p><code>= </code> <var>HINT_IN_WORDS</var></p>
<p class="final_hint">Thus, <code><var>DIGIT</var></code> is in the <var>SOLUTION</var> place.</p>
</div>
</div>
<div>
<div class="vars" data-ensure="NUMBER &gt; 99">
<var id="DIGITS">randRange( 0, 9, 4 )</var>
<var id="NUMBER">digitsToInteger( DIGITS )</var>
<var id="ADDENDS">[ ]</var>
<var id="HINT">
(function() {
var maxPower = DIGITS.length - 1;
return $.map(DIGITS, function(digit, index) {
if ( digit === 0 ) {
return null;
}
var addend;
if ( index === DIGITS.length - 1 ) {
if ( DIGITS[ index - 1] === 0 ) {
ADDENDS.push( digit );
return Cardinal( digit ) + " is the same as &lt;code&gt;" +
digit + "&lt;/code&gt;";
}
} else if ( index === DIGITS.length - 2 ) {
addend = digit * 10 + DIGITS[ DIGITS.length - 1 ];
ADDENDS.push( addend );
return Cardinal( addend ) + " is the same as &lt;code&gt;" +
addend + "&lt;/code&gt;";
} else {
var words = Cardinal( digit ) + " " + powerToPlace(maxPower - index);
var placeValue = pow(10, maxPower - index);
ADDENDS.push( digit * placeValue);
return words + " is the same as &lt;code&gt;" +
digit + "\\times" + placeValue + " = " +
(digit * placeValue) + "&lt;/code&gt;";
}
});
})()
</var>
</div>
<p class="question">Rewrite <var>cardinal( NUMBER )</var> in numerals.</p>
<p class="solution"><var>NUMBER</var></p>
<div class="hints">
<p data-each="HINT as hint"><var>hint</var></p>
<div>
<p>Add all these parts up:</p>
<p><code><var>ADDENDS.join( " + " )</var></code></p>
</div>
<p><code>= <var>NUMBER</var></code></p>
</div>
</div>
</div>
</div>
</body>
</html>