// Numbas version: exam_results_page_options {"name": "Cost of Sales Figures", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"parts": [{"shuffleChoices": false, "extendBaseMarkingAlgorithm": true, "unitTests": [], "choices": ["Choice 1", "Choice 2"], "variableReplacements": [], "displayType": "radiogroup", "minMarks": 0, "type": "1_n_2", "distractors": ["", ""], "matrix": [0, "1"], "displayColumns": 0, "scripts": {}, "marks": 0, "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "showCorrectAnswer": true, "maxMarks": 0}], "variables": {"sales": {"templateType": "anything", "group": "Ungrouped variables", "name": "sales", "definition": "repeat(random(1000..10000#100),numdepts)", "description": ""}, "tab": {"templateType": "anything", "group": "Ungrouped variables", "name": "tab", "definition": "table(data+[['Total','','',thousandsformat(sum(totals))]],['Dept','Cost','Sales','Profit'])", "description": ""}, "data": {"templateType": "anything", "group": "Ungrouped variables", "name": "data", "definition": "map(\n [\nnames[j],\nthousandsformat(costs[j]),\nthousandsformat(sales[j]),\nthousandsformat(totals[j])\n ],\n j,\n 0..numdepts-1\n)", "description": ""}, "costs": {"templateType": "anything", "group": "Ungrouped variables", "name": "costs", "definition": "repeat(random(1000..10000#100),numdepts)", "description": ""}, "names": {"templateType": "anything", "group": "Ungrouped variables", "name": "names", "definition": "shuffle(\n [\"Sales\",\"Engineering\",\"Research\",\"Production\",\"H R\"]\n)[0..numdepts]", "description": ""}, "totals": {"templateType": "anything", "group": "Ungrouped variables", "name": "totals", "definition": "map(sales[j]-costs[j],j,0..numdepts-1)", "description": ""}, "numdepts": {"templateType": "anything", "group": "Ungrouped variables", "name": "numdepts", "definition": "4", "description": ""}}, "variable_groups": [], "functions": {"thousandsformat": {"type": "string", "parameters": [["n", "number"]], "definition": "n = Math.round(n)+'';\nreturn n.replace(/(\\d{1,3}?)(\\d{3})$/,'$1,$2');", "language": "javascript"}}, "advice": "

Advice!

", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

A randomised table is contained in a div tag with the id #sales-table, so it can be styled using the CSS preamble.

"}, "name": "Cost of Sales Figures", "preamble": {"js": "", "css": "/* left-align fruit names */\n#sales-table td:first-child, #sales-table:first-child th {\n text-align: left;\n}\n\n/* rows alternate background colour so they're easier to read */\n#sales-table tr:nth-child(even) {\n background: #eee;\n}\n\n/* number columns in monospace font */\n#sales-table td:not(:first-child) {\nfont-family: monospace;\n}\n\n/* style for final totals row */\n#sales-table tr:last-child {\nbackground: #aaa;\nfont-weight: bold;\nborder-top: 2px solid black;\n}\n"}, "variablesTest": {"maxRuns": 100, "condition": ""}, "extensions": ["stats"], "tags": [], "statement": "

The Greenslate Profit Figures for 2018 are presented below.

\n
{tab}
", "rulesets": {}, "ungrouped_variables": ["sales", "numdepts", "totals", "names", "tab", "data", "costs"], "type": "question", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Colin Whitehead", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2486/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Colin Whitehead", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2486/"}]}