// Numbas version: exam_results_page_options {"name": "Early/Late time", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [["question-resources/clockImage_mod2_4h8YZGZ.svg", "/srv/numbas/media/question-resources/clockImage_mod2_4h8YZGZ.svg"]], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Early/Late time", "tags": [], "metadata": {"description": "

Student is presented with a clock showing a random time (in 15 minute increments) with an idication of whether it is morning or afternoon, along with a scheduled meeting time (in 24 hour mode). Question asks them to calculate difference between times and whether they are early or late.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "", "advice": "

We first convert the clock time to 24 hour mode. In this case, since the time on the clock is before 1 pm, we just combine the hours and minutes with a leading 0, to give the time as {clocktime}. In this case, since the time on the clock is after 1 pm we add 12 to the number of hours then combine the hours and minutes to give the time as {clocktime}.

\n

Next we need to calculate the time difference between the two times. Here the earlier time is {earlytime} and the later time is {latetime}.

\n

Adding 1 hour to the earlier time will bring us to {intermediatetime1} which is still earlier than {latetime}, so the later time is more than 1 hour after the earlier time. We then calculate the number of minutes from {intermediatetime1} to {latetime} which gives an additional {differenceMinutes} minutes.

\n

Adding 1 hour to the earlier time will bring us to {intermediatetime1} which is exactly the same as {latetime}, so the later time is exactly 1 hour after the earlier time.

\n

Adding 1 hour to the earlier time will bring us to {intermediatetime1} which is later than {latetime}, so the later time is less than 1 hour after the earlier time. We therefore calculate the number of minutes from {earlytime} to {latetime} which gives an additional {differenceMinutes} minutes.

\n

Since the hours of the earlier time and the later time are both the same we need only find the difference between the minutes of the two times which gives us {differenceminutes} minutes.

\n

Since the earlier time is the time on the clock of the meeting we are {difference} for the meeting

", "rulesets": {}, "extensions": ["jsxgraph"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"meetingHours": {"name": "meetingHours", "group": "Ungrouped variables", "definition": "random(8..18)", "description": "

Hours part of time for meeting - random between 8 and 18.

", "templateType": "anything", "can_override": false}, "meetingMinutes": {"name": "meetingMinutes", "group": "Ungrouped variables", "definition": "random(\"00\",\"30\")", "description": "

Minutes part of meeting time - random 00 or 30. String variable used in meetingTime variable

", "templateType": "anything", "can_override": false}, "meetingTime": {"name": "meetingTime", "group": "Ungrouped variables", "definition": "if(meetingHours<10,\"0\"+string(meetinghours),string(meetinghours))+meetingminutes", "description": "

Time for meeting as string, constructed from meetingHours and meetingMinutes

", "templateType": "anything", "can_override": false}, "differenceHours": {"name": "differenceHours", "group": "Ungrouped variables", "definition": "random(0,1)", "description": "

Hours part of time difference between meeting time and clock time - random 0 or 1

", "templateType": "anything", "can_override": false}, "differenceMinutes": {"name": "differenceMinutes", "group": "Ungrouped variables", "definition": "if(differenceHours=1,random(0,15,30,45),random(15,30,45))", "description": "

minutess part of time difference between meeting time and clock time - random 15, 30 or 45 (also 0 if difference hours is 1)

", "templateType": "anything", "can_override": false}, "difference": {"name": "difference", "group": "Ungrouped variables", "definition": "random(\"early\",\"late\")", "description": "

Is difference time before or after meeting time?

", "templateType": "anything", "can_override": false}, "clockHours": {"name": "clockHours", "group": "Ungrouped variables", "definition": "switch(difference=\"late\" and (meetingMinutes=\"00\" or differenceminutes<30),meetingHours+differenceHours,\n difference=\"late\" and differenceMinutes>15,meetingHours+differenceHours+1,\n difference=\"early\" and (meetingMinutes=\"00\" and differenceminutes>0),meetingHours-differenceHours-1,\n difference=\"early\" and (meetingMinutes=\"30\" and differenceminutes>30),meetingHours-differenceHours-1,\n meetingHours-differenceHours)", "description": "

Hours time to be shown on clockface determined from meetingTime components, difference time components and difference variables

", "templateType": "anything", "can_override": true}, "clockMinutes": {"name": "clockMinutes", "group": "Ungrouped variables", "definition": "if(difference=\"late\",\n mod(if(meetingMinutes=\"00\",differenceMinutes,differenceMinutes+30),60),\n mod(if(meetingMinutes=\"00\",-differenceMinutes,30-differenceMinutes),60))", "description": "

Minutes time to be shown on clockface determined from meetingTime components, difference time components and difference variables

", "templateType": "anything", "can_override": false}, "clock": {"name": "clock", "group": "Ungrouped variables", "definition": "jessiecode(\n 400,400, // Dimensions of JSXGraph board (in pixels)\n [-2.2,2.2,2.2,-2.2], // [left,top,right,bottom] in plot coordinates\n \"hourHandCoordsX = {hourHandCoords[0]};hourHandCoordsY = {hourHandCoords[1]};minuteHandCoordsX = {minuteHandCoords[0]};minuteHandCoordsY = {minuteHandCoords[1]};\"+safe(\"\"\"\n im = image('resources/question-resources/clockImage_mod2_4h8YZGZ.svg', [-2.05272,-2.05272],[4.10544,4.10544]) // In plot coordinates: [left x coord, bottom y coord],[distance from right to left, ditance from bottom to top]\n << highlight: false, fixed: true >>;\n\n segment([0,0],[hourHandCoordsX,hourHandCoordsY]) <>;\n segment([0,0],[minuteHandCoordsX,minuteHandCoordsY]) <>;\n\"\"\"),\n [\n \"axis\": false,\n \"grid\": false,\n \"showNavigation\": false,\n \"defaultAxes\": [\"x\": [\"scalable\": true, \"ticks\": [\"insertTicks\": true, \"minorTicks\": 0], \"ticksDelta\": 0.1], \"x\": [\"scalable\": true, \"ticks\": [\"insertTicks\": true, \"minorTicks\": 9], \"ticksDelta\": 0.1]]\n ]\n)", "description": "

JSXGraph object displaying clock

", "templateType": "anything", "can_override": false}, "hourhandcoords": {"name": "hourhandcoords", "group": "Ungrouped variables", "definition": "vector(hourHandRadius*cos(thetaHours),hourHandRadius*sin(thetaHours))", "description": "

coordinates for hour hand endpoint on clock face

", "templateType": "anything", "can_override": false}, "minutehandcoords": {"name": "minutehandcoords", "group": "Ungrouped variables", "definition": "vector(minuteHandRadius*cos(thetaMinutes),minuteHandRadius*sin(thetaMinutes))", "description": "

coordinates for minute hand endpoint on clock face

", "templateType": "anything", "can_override": false}, "hourhandradius": {"name": "hourhandradius", "group": "Ungrouped variables", "definition": "0.85", "description": "

length of hour hand on clock

", "templateType": "anything", "can_override": false}, "thetahours": {"name": "thetahours", "group": "Ungrouped variables", "definition": "(-30*clockhours-clockminutes/2+90)*(pi/180)", "description": "

Angle of hourhand relative to horizontal axis

", "templateType": "anything", "can_override": false}, "minutehandradius": {"name": "minutehandradius", "group": "Ungrouped variables", "definition": "1.2", "description": "

length of minute hand on clock

", "templateType": "anything", "can_override": false}, "thetaminutes": {"name": "thetaminutes", "group": "Ungrouped variables", "definition": "(-6*clockminutes+90)*(pi/180)", "description": "

angle of minute hand on clock face

", "templateType": "anything", "can_override": false}, "clockTime": {"name": "clockTime", "group": "Ungrouped variables", "definition": "switch(clockHours<10 and clockMinutes=0,\"0\"+string(clockhours)+\"00\",\n clockHours<10,\"0\"+string(clockhours)+string(clockminutes),\n clockHours>=10 and clockMinutes=0,string(clockhours)+\"00\",\n string(clockhours)+string(clockminutes))", "description": "

string version of time shown on clock in 24 hour mode

", "templateType": "anything", "can_override": false}, "meetingMinutesNumber": {"name": "meetingMinutesNumber", "group": "Ungrouped variables", "definition": "if(meetingminutes=\"00\", 0, 30)", "description": "

meeetingMinutes interpreted as a number

", "templateType": "anything", "can_override": false}, "earlytime": {"name": "earlytime", "group": "Ungrouped variables", "definition": "if(difference=\"early\",clocktime,meetingtime)", "description": "

the earlier of the meeting time and clock time

", "templateType": "anything", "can_override": false}, "latetime": {"name": "latetime", "group": "Ungrouped variables", "definition": "if(difference=\"early\",meetingtime, clocktime)", "description": "

the later time of the meeting time and clock time

", "templateType": "anything", "can_override": false}, "intermediatetime1": {"name": "intermediatetime1", "group": "Ungrouped variables", "definition": "if(earlytime=clocktime,\n switch(clockHours+1<10 and clockMinutes=0,\"0\"+string(clockhours+1)+\"00\",\n clockHours+1<10,\"0\"+string(clockhours+1)+string(clockminutes),\n clockHours+1>=10 and clockMinutes=0,string(clockhours+1)+\"00\",\n string(clockhours+1)+string(clockminutes)),\n if(meetingHours+1<10,\"0\"+string(meetinghours+1),string(meetinghours+1))+meetingminutes)", "description": "

Used by advce in how to calculate the time difference between the clock and the given time.

", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["meetingHours", "meetingMinutes", "meetingMinutesNumber", "meetingTime", "differenceHours", "differenceMinutes", "difference", "clockHours", "clockMinutes", "clock", "hourhandcoords", "minutehandcoords", "thetahours", "thetaminutes", "minutehandradius", "hourhandradius", "clockTime", "earlytime", "latetime", "intermediatetime1"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

You are due to attend a meeting at {meetingtime}. As you enter the building you notice the clock below (note that it is morning afternoon)

\n

{clock}

\n

By how many hours and minutes are you early or late for the meeting?

\n

You are [[0]] hours and [[1]] minutes [[2]] for the meeting.

", "stepsPenalty": "1.5", "steps": [{"type": "patternmatch", "useCustomName": true, "customName": "Time in 24-hour mode", "marks": "0", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

As a first step convert the time on the clock to 24-hour format.

\n

Since the time is before 1 pm, the 24-hour time will be the time as shown with a leading 0 to make it 4 digits long.

\n

Since the time is after 1 pm we need to add 12 to the hours to write it in 24 hour mode.

\n

Write the time in 24 hour mode.

", "answer": "{clocktime}", "displayAnswer": "{clocktime}", "matchMode": "regex"}, {"type": "information", "useCustomName": true, "customName": "Time difference", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Now calculate the difference between the two times.

\n

One way to do this is to start with the earlier time then 

\n
    \n
  1. Count the number of hours you need to bring the earlier time to just before the later time (for example if the earlier time was 0445 and the later time was 0730 you would add 2 hours to bring the time to 0645 - note that adding 3 hours would take you past the later time). Note that this number could be 0.
  2. \n
  3. Calculate how many minutes there are between the time you found in the previous part and the required time (continuing the previous example, we add 15 minutes to bring 0645 to 0700 and then a further 30 minutes to get to 0730).
  4. \n
  5. Add up the times you found in steps 1 and 2 (in the example we have 2 hours plus 15 minutes plus 30 minutes giving a total of 2 hours and 45 minutes).
  6. \n
\n

The time difference for the example is thus 2 hours and 45 minutes.

\n

"}, {"type": "information", "useCustomName": true, "customName": "Early or late?", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

If the clock time is before the meeting time you are early, otherwise you are late.

"}], "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "Hours", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "differenceHours", "maxValue": "differenceHours", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Minutes", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "differenceMinutes", "maxValue": "differenceMinutes", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "1_n_2", "useCustomName": true, "customName": "Early/Late", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["early", "late"], "matrix": ["if(difference=\"early\",1,0)", "if(difference=\"late\",1,0)"], "distractors": ["", ""]}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Don Shearman", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/680/"}, {"name": "Jim Pettigrew", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2037/"}, {"name": "Susan McGlynn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2148/"}, {"name": "Merryn Horrocks", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4052/"}]}]}], "contributors": [{"name": "Don Shearman", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/680/"}, {"name": "Jim Pettigrew", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2037/"}, {"name": "Susan McGlynn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2148/"}, {"name": "Merryn Horrocks", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4052/"}]}