// Numbas version: exam_results_page_options {"name": "Rounding and estimating calculations - adding up prices in a shop", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Rounding and estimating calculations - adding up prices in a shop", "type": "question", "tags": ["random names", "taxonomy"], "variablesTest": {"condition": "", "maxRuns": 100}, "variables": {"cash": {"templateType": "anything", "name": "cash", "description": "

Amount of cash we have.

", "definition": "if(can_afford,\n ceil(total_rounded_up)\n ,\n ceil(sum(p)+ice_cream)-1\n)\n ", "group": "Randoms"}, "can_afford": {"templateType": "anything", "name": "can_afford", "description": "

Can we afford all three items?

", "definition": "random(true,false)", "group": "Randoms"}, "total_rounded_up": {"templateType": "anything", "name": "total_rounded_up", "description": "

Total price of the three items when rounding up.

", "definition": "precround(p[0]+0.05,1) + precround(p[1]+0.05,1) + precround(ice_cream,1)", "group": "Randoms"}, "flavour": {"templateType": "anything", "name": "flavour", "description": "

Flavour of the ice cream.

", "definition": "random(\"strawberry cheesecake\", \"cookie dough\", \"mint chocolate chip\", \"vanilla\", \"raspberry\", \"Neapolitan\")", "group": "Randoms"}, "ice_cream": {"templateType": "anything", "name": "ice_cream", "description": "

Price of the ice cream

", "definition": "(random(100..380#10)+9)/100", "group": "Randoms"}, "p": {"templateType": "anything", "name": "p", "description": "

Prices of the first two items.

", "definition": "repeat((random(30..200 #10) + random(1..9))/100,2)", "group": "Randoms"}}, "extensions": [], "functions": {"pounds": {"parameters": [["n", "number"]], "type": "string", "language": "jme", "definition": "if(n>=1,currency(n,\"\u00a3\",\"\"), \"\u00a3\"+dpformat(n,2))"}}, "statement": "

Imagine you are shopping at the supermarket. You only have £{cash} in cash. There are two items in your basket so far, costing {currency(p[0],\"£\",\"p\")} and {currency(p[1],\"£\",\"p\")}.

\n

Just before checkout, you notice a tasty {flavour} ice cream on the shelf. It costs {currency(ice_cream,\"£\",\"p\")}. Can you put this in your basket without going over your limit?

", "variable_groups": [{"name": "Randoms", "variables": ["p", "ice_cream", "total_rounded_up", "can_afford", "cash", "flavour"]}, {"name": "Answers", "variables": []}], "parts": [{"scripts": {}, "variableReplacements": [], "marks": 0, "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "gaps": [{"displayColumns": 0, "minMarks": 0, "distractors": ["", ""], "variableReplacementStrategy": "originalfirst", "displayType": "radiogroup", "choices": ["

Round up.

", "

Round down.

"], "showFeedbackIcon": true, "shuffleChoices": false, "matrix": ["1", "0"], "variableReplacements": [], "marks": 0, "scripts": {}, "showCorrectAnswer": true, "maxMarks": 0, "type": "1_n_2"}], "showCorrectAnswer": true, "prompt": "

If we don't want to underestimate the total price of these items, do we round the individual prices up, or down?

\n

[[0]]

", "type": "gapfill"}, {"scripts": {}, "variableReplacements": [], "marks": 0, "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "gaps": [{"correctAnswerFraction": false, "precisionMessage": "You have not given your answer to the correct precision.", "precisionPartialCredit": 0, "scripts": {}, "type": "numberentry", "variableReplacementStrategy": "originalfirst", "allowFractions": false, "precision": "2", "precisionType": "dp", "maxValue": "total_rounded_up", "showFeedbackIcon": true, "minValue": "total_rounded_up", "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "mustBeReduced": false, "notationStyles": ["plain", "en", "si-en"], "showPrecisionHint": false, "marks": 1, "variableReplacements": [], "strictPrecision": false, "showCorrectAnswer": true}], "showCorrectAnswer": true, "prompt": "

Estimate the total price if we buy the ice cream, rounding the price of each item to 1 decimal place.

\n

£ [[0]]

\n

", "type": "gapfill"}, {"scripts": {}, "variableReplacements": [], "marks": 0, "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "gaps": [{"displayColumns": 0, "minMarks": 0, "type": "1_n_2", "variableReplacementStrategy": "originalfirst", "displayType": "radiogroup", "choices": ["

Yes, we do have enough cash.

", "

No, we may not have enough.

"], "showFeedbackIcon": true, "shuffleChoices": false, "matrix": "if(can_afford,[1,0],[0,1])", "variableReplacements": [], "marks": 0, "scripts": {}, "showCorrectAnswer": true, "maxMarks": 0}], "showCorrectAnswer": true, "prompt": "

Can we be sure that we have enough cash to pay for all three items?

\n

[[0]]

", "type": "gapfill"}], "ungrouped_variables": [], "rulesets": {}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Estimate whether you can afford an extra item in a shop by rounding prices to the nearest 10p.

"}, "preamble": {"css": "", "js": ""}, "advice": "

a)

\n

We want to ensure we won't go over the limit, so it is better to overestimate. If we underestimated, we could potentially think we have enough money when we don't.

\n

To overestimate our total, we round each price up.

\n

b)

\n

We round up all our values to 1 decimal place:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Original prices£{p[0]}£{p[1]}£{ice_cream}
Rounded up{pounds(precround(p[0]+0.05,1))}{pounds(precround(p[1]+0.05,1))}{pounds(precround(ice_cream,1))}
\n

Now we calculate the total of these rounded numbers:

\n

\\[ \\var{pounds(precround(p[0]+0.05,1))} + \\var{pounds(precround(p[1]+0.05,1))} + \\var{pounds(precround(ice_cream,1))} = \\var{pounds(total_rounded_up)} \\]

\n

c)

\n

As the estimated total, £{dpformat(total_rounded_up,2)}, is {if(can_afford,'lower','higher')} than £{cash}, we {if(can_afford,'do have','may not have')} enough money to purchase the {flavour} ice cream.

", "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/"}]}