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

111 lines (94 sloc) 4.906 kb
<!DOCTYPE html>
<html data-require="math math-format graphie word-problems interactive">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Decimals on the number line 1</title>
<script src="../khan-exercise.js"></script>
</head>
<body>
<div class="exercise">
<div class="vars">
<var id="LOWER_BOUND">0</var>
<var id="UPPER_BOUND">1</var>
<var id="MARK_INCREMENT"> 0.1 </var>
<var id="TENTHS"> randRange(1, 9) </var>
<var id="SOLUTION"> TENTHS * MARK_INCREMENT </var>
<var id="SOLN_TXT"> SOLUTION.toFixed(1) </var>
</div>
<div class="problems">
<div>
<div class="question">
<p>Move the <strong><code>\color{orange}{\text{orange dot}}</code></strong> to <strong><code>\color{orange}{<var>SOLN_TXT</var>}</code></strong> on the number line.</p>
<div class="graphie" id="number-line">
init({
range: [ [LOWER_BOUND - 0.3, UPPER_BOUND + 0.4], [-1, 1] ],
scale: [350, 40]
});
style({arrows: "&gt;"});
line( [ 0, 0 ], [ UPPER_BOUND + 0.06, 0 ] );
style({arrows: "-&gt;"});
line( [ 0, 0 ], [ LOWER_BOUND - 0.06, 0 ] );
style({arrows: ""});
for ( var x = LOWER_BOUND; x &lt;= UPPER_BOUND; x += MARK_INCREMENT ) {
line( [ x, -0.2 ], [ x, 0.2 ] );
}
style({ stroke: BLUE, strokeWidth: 3.5 });
line( [ LOWER_BOUND, -0.2], [LOWER_BOUND, 0.2]);
label( [ LOWER_BOUND, -0.53 ], LOWER_BOUND, "center", { color: BLUE });
line( [ UPPER_BOUND, -0.2], [UPPER_BOUND, 0.2]);
label( [ UPPER_BOUND, -0.53 ], UPPER_BOUND, "center", { color: BLUE });
addMouseLayer();
graph.movablePoint = addMovablePoint({ constraints: { constrainY: true }, snapX: 0.025 });
graph.movablePoint.onMove = function( x, y ) {
return [ min( max( LOWER_BOUND, x ), UPPER_BOUND ), y ];
};
</div>
</div>
<div class="solution" data-type="custom">
<span class="instruction"> Move the orange dot to select your answer. </span>
<div class="guess"> graph.movablePoint.coord[0] </div>
<div class="validator-function">
if ( guess === 0 ) {
return "";
}
return abs( SOLUTION - guess ) &lt; 0.001;
</div>
<div class="show-guess">
graph.movablePoint.setCoord( [ guess, 0 ] );
</div>
</div>
<div class="hints">
<p>Above we've drawn the number line from 0 to 1, divided into 10 equal pieces.</p>
<div>
<p>The line is divided into 10 pieces, which means:</p>
<p><code>\color{green}{\text{piece of line}}</code> = <code>\color{red}{<var>MARK_INCREMENT</var>}</code>
</div>
<p><code>\color{orange}{<var>SOLN_TXT</var>}</code> =
<code>\color{red}{<var>MARK_INCREMENT</var>}</code> * <code>\color{blue}{<var>TENTHS</var>}</code></p>
<p>Therefore, moving the <code>\color{orange}{\text{orange dot}}</code>
<code>\color{blue}{<var>TENTHS</var>}</code> place<var>plural(TENTHS)</var> will put it at the position
<code>\color{orange}{<var>SOLN_TXT</var>}</code>.</p>
<div>
<div class="graphie" data-update="number-line">
var MI = MARK_INCREMENT;
for ( var x = LOWER_BOUND + MI; x &lt; UPPER_BOUND - MI/2; x += MI ) {
label( [ LOWER_BOUND + x, -0.53 ], x.toFixed(1) , "center");
}
</div>
</div>
<div>
<div class="graphie" data-update="number-line">
style({ stroke: "#6495ED", fill: "#6495ED", strokeWidth: 3.5, arrows: "-&gt;" });
line( [ 0, 0 ], [ SOLUTION, 0 ] );
graph.movablePoint.visibleShape.toFront();
label( [ TENTHS, -0.53 ], SOLN_TXT, "center", { color: "orange" });
graph.movablePoint.moveTo( SOLUTION, 0 );
</div>
<p>The orange number shows where <code>\color{orange}{<var>SOLN_TXT</var>}</code> is on the number line.</p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.