// Numbas version: exam_results_page_options {"name": "Numerical reasoning - average salary", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"showfrontpage": false, "preventleave": false, "allowregen": true}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"progress": "ready", "metadata": {"notes": "", "licence": "Creative Commons Attribution 4.0 International", "description": "

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

"}, "tags": ["average", "maths-aid", "mean", "money", "numerical reasoning", "percentage", "weighted"], "statement": "

In a department {per}% of the staff have a salary of £{commanumber(salary)}, {per}% a salary of £{commanumber(salary)}, {per}% a salary of £{commanumber(salary)}, and {per}% a salary of £{commanumber(salary)}.

", "question_groups": [{"questions": [], "pickingStrategy": "all-ordered", "pickQuestions": 0, "name": ""}], "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)} has a frequency of {per}% which is $\\frac{\\var{per}}{100} = \\var{per/100}$. When we multiply these together we get \$£\\var{latex(commanumber(salary))} \\times \\frac{\\var{per}}{100} = \\var{salary*per/100}. \$

\n

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

", "variables": {"per3": {"definition": "100-per0-per1-per2", "name": "per3"}, "salary": {"definition": "shuffle([salary0,salary1,salary2,salary3])", "name": "salary"}, "per": {"definition": "shuffle([per0,per1,per2,per3])", "name": "per"}, "salary0": {"definition": "random(15000..50000#5000)", "name": "salary0"}, "per0": {"definition": "random(10..50#10)", "name": "per0"}, "per1": {"definition": "random(10..min(50,80-per0)#10)", "name": "per1"}, "salary1": {"definition": "random(15000..50000#5000 except salary0)", "name": "salary1"}, "average": {"definition": "(per*salary+per*salary+per*salary+per*salary)/100", "name": "average"}, "salary3": {"definition": "random(15000..50000#5000 except [salary0,salary1,salary2])", "name": "salary3"}, "per2": {"definition": "random(10..min(50,90-per0-per1)#10)", "name": "per2"}, "salary2": {"definition": "random(15000..50000#5000 except [salary0,salary1])", "name": "salary2"}}, "showQuestionGroupNames": false, "functions": {"commanumber": {"parameters": [["n", "number"]], "type": "string", "definition": "var parts=n.toString().split(\".\");\n if(parts && parts.length<2) {\n parts+='0';\n }\n return parts.replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\") + (parts ? \".\" + parts : \"\");", "language": "javascript"}}, "parts": [{"type": "gapfill", "gaps": [{"showPrecisionHint": false, "type": "numberentry", "marks": 1.0, "maxvalue": "average", "minvalue": "average"}], "prompt": "

What is the average salary?

\n

£ []

", "marks": 0.0}], "rulesets": {}, "type": "question", "extensions": [], "name": "Numerical reasoning - average salary", "contributors": [{"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/", "name": "Christian Lawson-Perfect"}], "variable_groups": []}]}], "contributors": [{"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/", "name": "Christian Lawson-Perfect"}]}