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

83 lines (79 sloc) 4.541 kb
<!DOCTYPE html>
<html data-require="math math-format graphie time">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Telling time</title>
<script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
<div class="vars">
<var id="HOUR">randRange( 1, 12 )</var>
<var id="MINUTE">randRange( 0, 11 ) * 5 </var>
<var id="NICE_MINUTE"> MINUTE &gt; 5 ? MINUTE : "0" + "" + MINUTE</var>
<var id="AM_PM">icu.getDateFormatSymbols().am_pm[HOUR &gt;= 7 ? 0 : 1]</var>
</div>
<div class="problems">
<div id="analog">
<div class="question">
<p>What time is it?</p>
<p class="render-answer-area-here"></p>
<div class="graphie" id="pie" style="float: left;">
init({ range: [ [-4, 4 ], [ -4, 4 ] ], scale: 25 });
clock = addAnalogClock({ hour: HOUR, minute: MINUTE, minuteTicks: 0, showLabels: false });
clock.draw();
</div>
<div class="graphie" id="digital" style="float: left;">
init({ range: [ [-5, 5], [-3, 3] ], scale: 25 });
</div>
<div style="clear: both;"></div>
</div>
<div class="solution" data-type="multiple">
<p class="short">The time is:<br><span class="sol short30" data-forms="integer"><var>HOUR</var></span> : <span class="sol short30" data-forms="integer"><var>NICE_MINUTE</var></span> <var>AM_PM</var></p>
</div>
<div class="hints">
<div>
<div class="graphie">
clock.drawLabels();
</div>
<div class="graphie" data-update="digital">
path([ [-3, -1], [3, -1], [3, 1], [-3, 1], [-3, -1] ]);
graph.time = label( [0, -0.1],
"\\Huge{\\phantom{00}:\\phantom{00}}",
"center" );
</div>
</div>
<p>The small hand is for the hour, and the big hand is for the minutes.</p>
<div>
<p data-if="MINUTE <= 10"> The hour hand is pointing at <code><var>HOUR</var></code>, so the hour is <code><var>HOUR</var></code>.</p>
<p data-else-if="MINUTE &gt; 10 &amp;&amp; MINUTE &lt; 45">The hour hand is between <code><var>HOUR</var></code> and <code><var>HOUR + 1 === 13 ? 1 : HOUR + 1</var></code>, so the hour is <code><var>HOUR</var></code>.</p>
<p data-else="">The hour hand is close to but hasn't passed <code><var>HOUR + 1 === 13 ? 1 : HOUR + 1</var></code>, so the hour is still <code><var>HOUR</var></code>.</p>
<div class="graphie" data-update="digital">
graph.time.remove();
var padding = HOUR &lt; 10 ? "\\phantom{0}" : "";
graph.time = label([0, -0.1],
"\\Huge{" + padding + HOUR + ":\\phantom{00}}",
"center" );
</div>
</div>
<div>
<p>The minute hand starts pointing straight up for <code>0</code> minutes, and it makes a complete circle in one hour (passing by all <code>12</code> numbers in <code>60</code> minutes).</p>
<p>For each number that the minute hand passes, add <code>\dfrac{60}{12} = 5</code> minutes.</p>
</div>
<div>
<p>The minute hand is pointing at <code><var> (MINUTE / 5) === 0 ? 12: MINUTE / 5 </var></code>, which represents <span data-if="MINUTE === 0"><code>0</code></span><span data-else=""><code>5 \times <var>(MINUTE / 5) === 0 ? 12: MINUTE / 5</var> = <var>MINUTE</var></code></span> minutes.</p>
<div class="graphie" data-update="digital">
graph.time.remove();
var padding = MINUTE &lt; 10 ? "0" : "";
graph.time = label([0, -0.1],
"\\Huge{" + HOUR + ":" + padding + MINUTE + "}",
"center" );
</div>
</div>
<p>The time is <code><var>HOUR</var></code>:<code><var>NICE_MINUTE</var></code>.</p>
</div>
</div>
</div>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.