// Numbas version: exam_results_page_options {"name": "Numerical reasoning - average salary", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {"commanumber": {"definition": "var parts=n.toString().split(\".\");\n if(parts[1] && parts[1].length<2) {\n parts[1]+='0';\n }\n return parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\") + (parts[1] ? \".\" + parts[1] : \"\");", "type": "string", "language": "javascript", "parameters": [["n", "number"]]}}, "name": "Numerical reasoning - average salary", "tags": ["average", "maths-aid", "mean", "money", "numerical reasoning", "percentage", "weighted"], "advice": "

This is a weighted average.

\n

The average value is given by multiplying each salary value by the frequency with which it occurs amongst the staff (in fraction form), and adding the resulting numbers together.

\n

For example, the salary £{commanumber(salary[0])} has a frequency of {per[0]}% which is $\\frac{\\var{per[0]}}{100} = \\var{per[0]/100}$. When we multiply these together we get \$£\\var{latex(commanumber(salary[0]))} \\times \\frac{\\var{per[0]}}{100} = \\var{salary[0]*per[0]/100}. \$

\n

For this question we have 4 salary values and the weighted average is \\\begin{align} & \\frac{\\var{per[0]}}{100} \\times \\var{latex(commanumber(salary[0]))} + \\frac{\\var{per[1]}}{100} \\times \\var{latex(commanumber(salary[1]))} + \\frac{\\var{per[2]}}{100} \\times \\var{latex(commanumber(salary[2]))} + \\frac{\\var{per[3]}}{100} \\times \\var{latex(commanumber(salary[3]))} \\\\ &= £\\var{latex(commanumber(salary[0]*per[0]/100))} + £\\var{latex(commanumber(salary[1]*per[1]/100))} + £\\var{latex(commanumber(salary[2]*per[2]/100))} + £\\var{latex(commanumber(salary[3]*per[3]/100))} \\\\ &= £\\var{latex(commanumber(average))} \\end{align} \

", "rulesets": {}, "parts": [{"prompt": "

What is the average salary?

\n

£ [[0]]

", "gaps": [{"minvalue": "average", "type": "numberentry", "maxvalue": "average", "marks": 1.0, "showPrecisionHint": false}], "type": "gapfill", "marks": 0.0}], "extensions": [], "statement": "

In a department {per[0]}% of the staff have a salary of £{commanumber(salary[0])}, {per[1]}% a salary of £{commanumber(salary[1])}, {per[2]}% a salary of £{commanumber(salary[2])}, and {per[3]}% a salary of £{commanumber(salary[3])}.

", "variable_groups": [], "progress": "ready", "type": "question", "variables": {"salary": {"definition": "shuffle([salary0,salary1,salary2,salary3])", "name": "salary"}, "salary1": {"definition": "random(15000..50000#5000 except salary0)", "name": "salary1"}, "salary0": {"definition": "random(15000..50000#5000)", "name": "salary0"}, "salary3": {"definition": "random(15000..50000#5000 except [salary0,salary1,salary2])", "name": "salary3"}, "salary2": {"definition": "random(15000..50000#5000 except [salary0,salary1])", "name": "salary2"}, "average": {"definition": "(per[0]*salary[0]+per[1]*salary[1]+per[2]*salary[2]+per[3]*salary[3])/100", "name": "average"}, "per": {"definition": "shuffle([per0,per1,per2,per3])", "name": "per"}, "per3": {"definition": "100-per0-per1-per2", "name": "per3"}, "per2": {"definition": "random(10..min(50,90-per0-per1)#10)", "name": "per2"}, "per1": {"definition": "random(10..min(50,80-per0)#10)", "name": "per1"}, "per0": {"definition": "random(10..50#10)", "name": "per0"}}, "metadata": {"notes": "", "description": "

Compute the weighted average salary in a department, given four salary levels and the percentages of staff earning them.

", "licence": "Creative Commons Attribution 4.0 International"}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}