Element(randomCaseVariation, Mod(countQuestion, Length(randomCaseVariation)) + 1)

cycle through 4 cases so the same question doesn't appear twice in a row.  Element(questionOrder, Mod(countQuestion, Length(questionOrder)) + 1)

the number of cupcakes the baker needs to sell \if he doesn't sell any brownies.

the number of brownies the baker needs to sell\if he doesn't sell any cupcakes.

the total number of items the baker needs to sell\
to meet his quota.

the total value of all the baking sold.

Element({{x(InputPointCoords), y(InputPointCoords), If(caseVariant ≟ 1, numberInput, listSelection)}, {x(InputPointCoords), y(InputPointCoords), numberInput}, {numberInput, numberInputB}, {x(InputPointCoords), y(InputPointCoords), Element({numberInput, listSelection}, caseVariant)}}, caseNum)

\textsf{The }\(y\)\textsf{-intercept is the point where the graph crosses the }\(y\)\textsf{-axis. }

\textsf{The }\(x\)\textsf{-intercept is the point where the graph crosses the }\(x\)\textsf{-axis. }

#D2E4E2

Stu had some money saved. He saves money for several \
more weeks to buy a new pair of shoes. The graph shows \how much money he saved. Use the graph to answer the \
questions below.

#4D4D4D

$\text{Check}$

$\text{NEW PROBLEM}$

Fix position and allow selection for all text objects

Empty all input boxes

\text{}

Reset app

\text{}

#006758

#B00020

#252525

#757575

#949494

#E44461

#DA2570

#E66B9E

#3A6ED6

#5991FF

#008475

#0F8538

#00a83c

#5145A8

#6557D2

#8575FF

#903D14

#BD6C43

#C75000

#E07415

#eeeeee

#2E006758

#2EB00020

Tia is draining water from a tank. The graph shows\
the relationship between the amount of water\
left in the tank and how much time has passed \
since she started draining it.

The table of values represents a linear relationship.

A baker sells brownies for \(\$3.50\) each and cupcakes \
for \(\$1.50\) each. The baker needs to sell \(\$210\) worth of \
items by the end of the day. Use the graph to\
answer the following questions.

$\math\textsf{Write the coordinates of the }\(y\)\textsf{-intercept. }$

$\text{What are the coordinate of the x-intercept?}$

$\text{How many litres of water were in \\the tank when Tia started draining it?}$

$\text{How many minutes did it take to \\drain all the water from the tank?}$

$\math\textsf{Write the coordinates of the }\(x\)\textsf{-intercept.}$

$\mathsf{%v}$

$\mathsf{%v}$

$\text{How many cupcakes does the baker need to\\sell if he is not able to sell any brownies?}$

$\textsf{Before he started saving, Stu had \$}$

$\math\textsf{What is the }\(y\)\textsf{-intercept?}$

$\math\textsf{What is the }\(x\)\textsf{-intercept?}$

inputSaved: {"", ""}
countQuestion = 0
randomCaseVariation = Shuffle({1, 1, 1, 1, 1, 2, 2, 2, 2, 2})
caseVariant = Element(randomCaseVariation, Mod[countQuestion, Length[randomCaseVariation]] + 1)
questionOrder = Shuffle({1, 2, 3, 4})
caseNum = Element(questionOrder, Mod[countQuestion, Length[questionOrder]] + 1)
randomYCase1 = Shuffle(Sequence[10, 40, 10])
yCase1 = Element(randomYCase1, Mod[countQuestion, Length[randomYCase1]] + 1)
selectCase1 = Zip((("$\text{" * A) * " }$"), A, {"\phantom{item 1}", "the amount of money Stu saved over six weeks.", "the amount of money Stu had at the start.", (("the amount of time Stu took to save \$" * yCase1) * ".")})
selectCase4 = Zip((("$\text{" * A) * " }$"), A, {"\phantom{empty entry}", options4b1, options4b4, options4b2, options4b3})
listSelection = If(caseNum ≟ 1, SelectedIndex[selectCase1], SelectedIndex[selectCase4])
inputCurrent = Element({{inputPointCoordsTemp, If[caseVariant ≟ 1, numberInputTemp, ("" * listSelection)]}, {inputPointCoordsTemp, numberInputTemp}, {numberInputTemp, numberInputBTemp}, {inputPointCoordsTemp, Element[{numberInputTemp, ("" * listSelection)}, caseVariant]}}, caseNum)
emptyStringsInCurrent = Sum(Zip[A ≟ "" ∨ Length[ReplaceAll[A, "?", ""]] ≠ Length[A], A, inputCurrent])
randomList1 = Shuffle(Sequence[20])
randomSlope = Shuffle(Sequence[6, 12])
randomStart = Shuffle(Sequence[20])
randomList2 = Shuffle(Sequence[15])
hintsCase1: {hintYIntercept, "\textsf{At the }\(y\)\textsf{-intercept, the number of weeks equals zero.}"}
hintsCase3: {hintXIntercept, hintYIntercept}
hintsCase2: {If[caseVariant ≟ 1, hintXIntercept, hintYIntercept], If[caseVariant ≟ 1, "\textsf{The }\(y\)\textsf{-intercept is the point at which Tia starts draining water. }", "\textsf{The }\(x\)\textsf{-intercept is the point where all the water has been drained from the tank. }"]}
hintsCase4: {hintXIntercept, If[caseVariant ≟ 1, "\textsf{The point where no brownies are sold is the }\(y\)\textsf{-intercept. }", "\textsf{The }\(x\)\textsf{-intercept is the point where no cupcakes are sold. }"]}
numberInput = NaN
InputPointCoords: (NaN, NaN)
numberInputB = NaN
correct1A: InputPointCoords ≟ (0, yCase1)
correct1B = Element({numberInput ≟ yCase1, listSelection ≟ 3}, caseVariant)
randomYCase2 = Shuffle({8, 10, 12, 14, 16})
yCase2 = Element(randomYCase2, Mod[countQuestion, Length[randomYCase2]] + 1)
randomXCase2 = Sequence(1, 5)
xCase2 = Element(randomXCase2, Mod[countQuestion, Length[randomXCase2]] + 1)
correct2B: numberInput ≟ Element[{yCase2, xCase2 / 2}, caseVariant]
correct3A: numberInput ≟ xCase2
correct3B: numberInputB ≟ yCase2
correct4A: InputPointCoords ≟ (70, 0)
correct2A: InputPointCoords ≟ Element[{(xCase2 / 2, 0), (0, yCase2)}, caseVariant]
maxY = Element({10, 10, 10, 10}, caseNum)
minY = If(caseNum ≟ 3, (-maxY), 0)
maxX = Element({10, 10, 10, 10}, caseNum)
minX = If(caseNum ≟ 3, (-maxX), 0)
correct4B: numberInput ≟ Element[{140, 70}, caseVariant]
correctB = Element({correct1B, correct2B, correct3B, correct4B}, caseNum)
correctA = Element({correct1A, correct2A, correct3A, correct4A}, caseNum)
case3InputB: NaN
case3inputA: 1
studentAnsY: NaN
case1InputC = SelectedIndex(selectCase1)
showsolution = false
funcCase3(x) = (((-yCase2)) / xCase2 * x) + yCase2
dataCase3 = Sequence((A, funcCase3(A)), A, -2, 5)
case1InputC_{1}: (NaN, NaN)
firstCase = Element(randomStart, 1)
randomNum2 = Element(randomList2, Mod[countQuestion, 15] + 1)
input2: NaN
randomNum1 = Element(randomList1, Mod[countQuestion, 20] + 1)
input1: NaN
validate = false
showanswer = false
tries = 0
countCorrect = 0
showhint = false
correct2: inputCurrent ≟ If[caseVariant ≟ 2, {0, yCase2, xCase2 / 2}, {xCase2 / 2, 0, yCase2}]
showbuttons = true
typicalError1: 0
typicalError2: 0
showhinttypicalerror = false
textCountCorrect: "\text{Number correct: " + (LaTeX[countCorrect]) + " }"
labelBtnValidate: "\text{CHECK (" + (LaTeX[3 - tries]) + ")}"
helpTextHint: "" + (LaTeX[If[¬correct1A, (Element[{hintsCase1(1), hintsCase2(1), hintsCase3(1), hintsCase4(1)}, caseNum] * "\\"), ""]]) + "" + (LaTeX[If[¬correct1B, Element[{hintsCase1(2), hintsCase2(2), hintsCase3(2), hintsCase4(2)}, caseNum], ""]]) + ""
pixelsRight: 16
pixelsLeft: 16
pixelsBottom: 16
pixelsTop: 24
borderBox = Polygon(Zip[PixelsToPoint[Corner[1], Corner[3], Corner[5], A], A, {(pixelsLeft, pixelsTop), (pixelsLeft, y(Corner[5]) - pixelsBottom), Corner[5] - (pixelsRight, pixelsBottom), (x(Corner[5]) - pixelsRight, pixelsTop)}])
layoutY = Element({260, 260, 170, 300}, caseNum)
layoutX: 16
layoutAppSize = Corner(5)
caseOrder: {1, 3, 2, 4, 2, 3, 1, 4, 3, 2, 1, 4, 2, 3, 1, 2, 4, 3, 1, 4, 3, 2, 1, 3, 2, 4}
slopeCase1: randomSlope(Mod[countQuestion, Length[randomSlope]] + 1)
viewbox = Polygon({(minX, minY), (maxX, minY), (maxX, maxY), (minX, maxY)})
textQuestion: "\text{" + (LaTeX[Element[{Question1, Question2, Question3, Question4}, caseNum]]) + "}"
yNumbers = Element({Sequence[i, i, 10, 100, 10], Sequence[i, i, 4, 20, 4], Sequence[i, i, -20, 20, 4], Sequence[i, i, 40, 200, 40]}, caseNum)
xNumbers = Element({Sequence[10], Sequence[i, i, 1, 5], Sequence[-10, 10, 2], Sequence[i, i, 20, 100, 20]}, caseNum)
lblX = Text("x", (maxX + 0.8, 0.2), false, true, 1, 0)
inputCase1B = Textfield(InputPointCoords)
graph1: y = ((0.1 * slopeCase1) * x) + yCase1 / 10
inputCase2A = Textfield(InputPointCoords)
inputCase2B1 = Textfield(numberInput)
inputCase2B2 = Textfield(numberInput)
graph2 = Line((0, yCase2 / 2), (xCase2, 0))
viewboxCover: viewbox
showGraph: caseNum ≠ 3 ∨ showsolution
randomData = If(caseVariant ≟ 1, {{}})
funcCase4 = Line((0, 7), (5, 2))
axisLabelX: "\text{" + (LaTeX[Element[{"Time (weeks)", "Time (minutes)", "", "\# brownies sold"}, caseNum]]) + "}"
input4A = Textfield(InputPointCoords)
caseBinputB1: NaN
caseBInputB2: NaN
solnCase1: "\textsf{The coordinates of the }\(" + (LaTeX[If[caseVariant ≟ 1, "x", "y"]]) + "\)\textsf{-intercept are }(0," + (LaTeX[yCase1]) + ").\\" + (LaTeX[If[caseVariant ≟ 1, (("\textsf{Before he started saving, Stu had \$" * yCase1) * ".}"), "\textsf{The }\(y\)\textsf{-intercept represents the amount of money Stu had at the start.}"]]) + ""
solnCase2: "" + (LaTeX[If[caseVariant ≟ 1, (("\textsf{The coordinates of the }\(x\)\textsf{-intercept are }(" * xCase2 / 2) * ",0). "), (("\textsf{The coordinates of the }\(y\)\textsf{-intercept are }(0," * yCase2) * ").")]]) + "
\\\textsf{" + (LaTeX[If[caseVariant ≟ 1, (("When Tia started draining the tank, it contained " * yCase2) * " litres of water."), (((("It took " * xCase2 / 2) * " minute") * If[xCase2 ≟ 2, "", "s"]) * " to drain all the water from the tank.")]]) + "}"
solnCase3: "\textsf{The }\(x\)\textsf{-intercept is " + (LaTeX[xCase2]) + " }\\\textsf{and the }\(y\)\textsf{-intercept is " + (LaTeX[yCase2]) + ".}"
solnCase4: "\textsf{The coordinates of the }\(x\)\textsf{-intercept are }(70,0).\\\textsf{" + (LaTeX[If[caseVariant ≟ 1, "The baker needs to sell 140 cupcakes \\if he is not able to sell any brownies.", "The }\(x\)\textsf{-intercept represents the number of brownies }\\\textsf{the baker needs to sell if he is not able to sell any cupcakes."]]) + "}"
PSoln2: (xCase2, 0)
col1 = Append("\textbf{\(x\)}", Zip[("" * If[showsolution ∧ (x(A) ≟ 0 ∨ y(A) ≟ 0), (((("\cellcolor{" * colorTealBackground) * "}{") * x(A)) * "}"), ("" * x(A))]), A, dataCase3])
col2 = Append("\textbf{\(y\)}", Zip[("" * If[showsolution ∧ (x(A) ≟ 0 ∨ y(A) ≟ 0), (((("\cellcolor{" * colorTealBackground) * "}{") * y(A)) * "}"), ("" * y(A))]), A, dataCase3])
PSoln = Element({(0, yCase1 / 10), (0, yCase2 / 2), (0, yCase2 / 2), (7, 0)}, caseNum)
input4B1 = Textfield(numberInput)
input1A = Textfield(numberInput)
input3B = Textfield(numberInputB)
correct1: inputCurrent ≟ {0, yCase1, If[caseVariant ≟ 1, yCase1, 3]}
correct2new = If(caseVariant ≟ 2, {0, yCase2, xCase2}, {})
correct3: inputCurrent ≟ {xCase2, yCase2}
correct4: inputCurrent ≟ If[caseVariant ≟ 1, {70, 0, 140}, {70, 0, 4}]
input3A = Textfield(numberInput)
enableBtnValidate: inputCurrent ≠ inputSaved ∧ emptyStringsInCurrent ≟ 0 ∧ (¬(inputCurrent(2) ≟ "1" ∧ caseVariant ≟ 2 ∧ (caseNum ≟ 1 ∨ caseNum ≟ 4)))
correct: correctA ∧ correctB
textFeedback: "" + (LaTeX[If[correct, "$\text{✓ Correct}$", "$\text{✕ " + (If[tries < 3, "Try again", "Maybe next time"]) + "}$"]]) + ""
isTypicalError: false
showhints = Element({{}, If[caseVariant ≟ 1, {true, false}, {false, true}], {}, {}}, caseNum)
feedback1: "" + (LaTeX[If[correctA, "$\text{✓}$", "$\text{✕}$"]]) + ""
feedback2: "" + (LaTeX[If[correctB, "$\text{✓}$", "$\text{✕}$"]]) + ""
checkAPosX = Element({450, 470, 300, 440}, caseNum)
checkAPosY = Element({136, 142, 65, 147}, caseNum)
checkBPosX = Element(Element[{{381, 450}, {397, 365}, {302, 300}, {440, 470}}, caseNum], caseVariant)
checkBPosY = Element(Element[{{208, 218}, {213, 207}, {119, 119}, {227, 225}}, caseNum], caseVariant)
axisX = Segment((minX, 0), (maxX + 0.5, 0))
axisY = Segment((0, minY), (0, maxY + 0.5))
lblx = Zip(Text[("" * If[A ≠ 0, ("" * A), ""]), (B + 0.2, 0), false, true, 0, -1], A, xNumbers, B, Sequence[Element[{1, 2, minX, 2}, caseNum], 10, Element[{1, 2, 2, 2}, caseNum]])
lbly = Zip(Text[("" * If[A ≠ 0, ("" * A), ""]), (0, B + 0.2), false, true, -1, 0], A, yNumbers, B, Sequence[Element[{1, 2, minY, 2}, caseNum], 10, Element[{1, 2, 2, 2}, caseNum]])
xTicks = Sequence(Segment[(A, 0), (A, 0.2)], A, minX, maxX, If[caseNum > 1, 2, 1])
yTicks = Sequence(Segment[(0, A), (0.2, A)], A, minY, maxY, If[caseNum > 1, 2, 1])
xMin = If(caseNum ≟ 3, -40, -25)
xMax = If(caseNum ≟ 3, 15, 12)
yMax = If(caseNum ≟ 3, 13, 14)
yMin: yMax - (500 / 800 * (xMax - xMin))
axisLabelY: "\text{" + (LaTeX[Element[{"Amount of \\Money (\$)", "\\Water (liters)  ", "", "\\\# cupcakes sold"}, caseNum]]) + "}"
case3Table = TableText(col1, col2, "vr|_", 5, 30)
layoutFeedbackX: layoutX + If[correct ∨ tries ≟ 3, -5, 126]
captionCase2a: "\textsf{What are the coordinates of the }\(" + (LaTeX[If[caseVariant ≟ 1, "x", "y"]]) + "\)\textsf{-intercept?}"
dropdownQuestion: "\textsf{The }" + (LaTeX[If[caseNum ≟ 1, "y", "x"]]) + "\textsf{-intercept represents}"
lblY = Text("y", (0.7, maxY + 0.3), false, true, 0, 1)
textSolution: "\textsf{\bold{Possible Solution}}\\" + (LaTeX[Element[{solnCase1, solnCase2, solnCase3, solnCase4}, caseNum]]) + ""
lblSolnX: "" + (LaTeX[Element[{(("(0," * yCase1) * ")"), (("(0," * yCase2) * ")"), (("(0," * yCase2) * ")"), "(70,0)"}, caseNum]]) + ""
textHint: "\textsf{\color{" + (LaTeX[colorOrange]) + "}\bold{Hint}}\\" + (LaTeX[If[showhinttypicalerror, helpTextHintTypicalError]]) + "" + (LaTeX[If[showhint ∧ showhinttypicalerror, "\\"]]) + "" + (LaTeX[If[showhint, helpTextHint]]) + ""
enableInput: tries < 3 ∧ (¬(validate ∧ correct))

Tool: PixelsToPoint
PixelsToPoint(Corner1,Corner3,Corner5,PixelCoords)
Input: Corner1, Corner3, Corner5, InputPixels
Output: OutputPoint

InputPixels: (100, 200)
xRight: x(Corner3)
xLeft: x(Corner1)
yTop: y(Corner3)
yBottom: y(Corner1)
yCoord: yTop - (y(InputPixels) / y(Corner5) * (yTop - yBottom))
xCoord: (x(InputPixels) / x(Corner5) * (xRight - xLeft)) + xLeft
OutputPoint: (xCoord, yCoord)

Tool: PixelsToPoint (command PixelsToPoint1)
PixelsToPoint(Corner1,Corner3,Corner5,PixelCoords)
Input: Corner1, Corner3, Corner5, InputPixels
Output: OutputPoint

InputPixels: (100, 200)
xRight: x(Corner3)
xLeft: x(Corner1)
yTop: y(Corner3)
yBottom: y(Corner1)
yCoord: yTop - (y(InputPixels) / y(Corner5) * (yTop - yBottom))
xCoord: (x(InputPixels) / x(Corner5) * (xRight - xLeft)) + xLeft
OutputPoint: (xCoord, yCoord)

Tool: PointToPixels
PointToPixels(Corner1,Corner3,Corner5,InputPoint)
Input: Corner1, Corner3, Corner5, InputPoint
Output: OutputPixels

Corner1: (-5, -5)
Corner3: (16, 6)
Corner5: (300, 200)
xLeft: x(Corner1)
xRight: x(Corner3)
yTop: y(Corner3)
yBottom: y(Corner1)
yPixels: (y(Corner5) * (y(InputPoint) - yBottom) / (yTop - yBottom))
xPixels: (x(Corner5) * (x(InputPoint) - xLeft) / (xRight - xLeft))
OutputPixels: (xPixels, yPixels)