// Numbas version: exam_results_page_options {"name": "Calculate a student discount", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Calculate a student discount", "tags": ["decrease", "discount", "percentages", "taxonomy"], "metadata": {"description": "

Given a student discount, calculate a discounted price.

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

{pname} is buying a new {item}. The price of the model he picked is £{price}. On a website with discounts for students, he found a voucher for a discount of {percentage}%.

", "advice": "

There are multiple methods to approach this problem. The first method involves working out the discounted price as a percentage of the original, while the second method calculates the value of the discount and subtracts that from the listed price.

\n

Method 1

\n

There is a {percentage}% decrease in price. This means that the new price will be {100-percentage}% of the old price.

\n

\\[\\begin{align} \\frac{\\var{100-percentage}}{100} \\times \\var{price} &= \\var{(100-percentage)/100*price} \\\\&= \\var{dpformat((100-percentage)/100*price, 2)}\\text{.} \\end{align}\\]

\n

Or, using the multiplier method,

\n

\\[\\begin{align} \\var{(100-percentage)/100} \\times \\var{price} &= \\var{(100-percentage)/100*price}\\\\&= \\var{dpformat((100-percentage)/100*price, 2)}\\text{.} \\end{align}\\]

\n

When we are talking about money, it is usually assumed that we will round the answer to 2 decimal places.

\n

Method 2

\n

We find the discount first. This is

\n

\\[\\frac{\\var{percentage}}{100} \\times \\var{price} = \\var{(percentage)/100*price}\\text{.}\\]

\n

Or using a decimal multiplier,

\n

\\[\\var{(percentage)/100} \\times \\var{price} = \\var{(percentage)/100*price}\\text{.}\\]

\n

Then we subtract the discount from the original price to get the new price:

\n

\\[ \\var{price} - \\var{dpformat(discount,2)} = \\var{dpformat(price - discount, 2)}\\text{.} \\]

\n

", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"discount": {"name": "discount", "group": "Ungrouped variables", "definition": "percentage*price/100", "description": "", "templateType": "anything", "can_override": false}, "pname": {"name": "pname", "group": "Ungrouped variables", "definition": "random(\"Josh\", \"Adam\", \"Mike\", \"Trevor\", \"Alex\")", "description": "

A male name.

", "templateType": "anything", "can_override": false}, "discountrounded": {"name": "discountrounded", "group": "Ungrouped variables", "definition": "precround(discount,2)", "description": "", "templateType": "anything", "can_override": false}, "price": {"name": "price", "group": "Ungrouped variables", "definition": "switch(\n item = \"TV\", random(170.99..1199.99), \n item = \"laptop\", random(200.99..799.99),\n item = \"smartphone\", random(100.99..799.99),\n item = \"PC\", random(200.99..969.99),\n item = \"gaming console\", random(80.99..349.99),\n random(110.99..649.99))\n", "description": "

Price of an item.

", "templateType": "anything", "can_override": false}, "item": {"name": "item", "group": "Ungrouped variables", "definition": "random(\"TV\", \"laptop\", \"smartphone\", \"PC\", \"gaming console\", \"fridge\")", "description": "

The bought item.

", "templateType": "anything", "can_override": false}, "percentage": {"name": "percentage", "group": "Ungrouped variables", "definition": "random(5..40 #5)", "description": "

Discount percentage.

", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": "1000"}, "ungrouped_variables": ["item", "pname", "price", "percentage", "discount", "discountrounded"], "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": "

What will the discounted price of the {item} be?

\n

Round your answer to the nearest penny.

\n

£ [[0]]

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "(100-percentage)/100*price", "maxValue": "(100-percentage)/100*price", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": "2", "precisionPartialCredit": "0", "precisionMessage": "

Your answer does not make sense in real life, we cannot divide a penny any further. Shops always round their prices for items. That is why you should have rounded your answer to $\\var{precround((100-percentage)/100*price, 2)}$.

", "strictPrecision": false, "showPrecisionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Stanislav Duris", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1590/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Stanislav Duris", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1590/"}]}