#4D4D4D

$\text{Check}$

$\text{NEW PROBLEM}$

Fix position and allow selection for all text objects

Reset app

#006758

#B00020

#252525

#757575

#949494

#E44461

#DA2570

#E66B9E

#3A6ED6

#5991FF

#008475

#0F8538

#00a83c

#5145A8

#6557D2

#8575FF

#903D14

#BD6C43

#C75000

#E07415

#eeeeee

#2E006758

#2EB00020

\text{\vphantom{|}1 hr}

#E2DFF8

#6557D2

\renewcommand{\CancelColor}{\color{red}}
\text{\cancel{mi}}

\text{Drag these quantites to the boxes}

$\text{TRY AGAIN}$

countQuestion = 1
randomSpeeds = Sequence(Random[5, 65], i, 1, 100)
adjuster: (7, -5)
fractionBarYCoord: 310
fractionBar4Start: (515, fractionBarYCoord)
fractionBar4 = Segment(fractionBar4Start, fractionBar4Start + (150, 0))
answerStep2Location = Midpoint(fractionBar4)
givenSpeed = Element(randomSpeeds, Mod[countQuestion, Length[randomSpeeds] + 1])
randomUnitSelection = Shuffle(Sequence[Random[1, 4], i, 1, 100])
unitSelector = Element(randomUnitSelection, countQuestion)
conversionFactor = Element({5280, 1760, 1609.34, 1.61}, Element[randomUnitSelection, Mod[countQuestion, Length[randomUnitSelection] + 1]])
rightAnswerNumber: (givenSpeed * conversionFactor)
textRightNumeratorWithComma: "" + (Div[rightAnswerNumber, 1000]) + "," + (If[Mod[rightAnswerNumber, 1000] < 10, "00", If[Mod[rightAnswerNumber, 1000] < 100, "0", ""]]) + "" + (Mod[rightAnswerNumber, 1000]) + ""
textRightNumeratorNoComma: "" + rightAnswerNumber + ""
newUnitAbbr = Element({"ft", "yd", "m", "km"}, unitSelector)
textRightNumeratorShortFree: "\text{\vphantom{|}" + (LaTeX[If[rightAnswerNumber ≥ 1000, textRightNumeratorWithComma + " " + newUnitAbbr, textRightNumeratorNoComma + " " + newUnitAbbr]]) + "}"
oneMilePoint = (338, 410)
boxVerticalPixels: 30
boxHorizontalPixels: 100
textAnchors: {(54, 340), (59, 305), (150, 317), (150, 273), (338, 410), (460, 410), (380, 419)}
denominatorBox, j, k, l, m = Polygon(textAnchors(4), textAnchors(4) + (boxHorizontalPixels, 0), textAnchors(4) + (boxHorizontalPixels, boxVerticalPixels), textAnchors(4) + (0, boxVerticalPixels))
numeratorBox, f, g, h, i = Polygon(textAnchors(3), textAnchors(3) + (boxHorizontalPixels, 0), textAnchors(3) + (boxHorizontalPixels, boxVerticalPixels), textAnchors(3) + (0, boxVerticalPixels))
newUnitPoint = (460, 410)
conversionFactorText = Element({"5,280", "1,760", "1,609.34", "1.61"}, unitSelector)
validate = false
textNewUnitFree: "\text{" + (LaTeX[conversionFactorText]) + " " + (LaTeX[newUnitAbbr]) + "\vphantom{|}}"
newUnitLocation = If(IsInRegion[newUnitPoint, numeratorBox], "numerator", If[IsInRegion[newUnitPoint, denominatorBox], "denominator", "neither"])
showanswer = false
showsolution = false
tries = 0
countCorrect = 0
showhint = false
oneMileLocation = If(IsInRegion[oneMilePoint, numeratorBox], "numerator", If[IsInRegion[oneMilePoint, denominatorBox], "denominator", "neither"])
showbuttons: (¬validate) ∧ newUnitLocation ≠ "neither" ∧ oneMileLocation ≠ "neither" ∧ whichIsMoving ≟ ""
pixelsRight: 16
pixelsLeft: 16
pixelsBottom: 16 + 36 + 24 + 16 + 8
pixelsTop: 24 + 16 + 8
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: 270
layoutX: x(Element[textAnchors, 1])
layoutAppSize = Corner(5)
textCountCorrect: "\text{Number correct: " + (LaTeX[countCorrect]) + " }"
newUnit = Element({"feet", "yards", "meters", "kilometers"}, unitSelector)
textQuestion: "\text{How many " + (LaTeX[newUnit]) + " per hour are you going when you are in a car going " + (LaTeX[givenSpeed]) + " miles per hour?} "
xMin: 0
xMax: 800
yMin: 0
yMax: 500
newUnitDimensions: Corner[textNewUnitFree, 3] - Corner[textNewUnitFree, 1] + adjuster
correct: newUnitLocation ≟ "numerator" ∧ oneMileLocation ≟ "denominator"
moving: whichIsMoving ≠ ""
oneMileChanging = If(validate ∧ correct, textOneMileStrikeThrough, "mi")
newUnitBox = Tool7(boxVerticalPixels, boxHorizontalPixels, newUnitPoint)
oneMileBox = Tool7(boxVerticalPixels, boxHorizontalPixels, oneMilePoint)
textOneMileFree = Text(("$\text{" * 1) + " " + ((oneMileChanging * "\vphantom{|}}")), (0, 0), true, true)
textMovableNewUnit = Text(textNewUnitFree, newUnitPoint + (Corner[textNewUnitFree, 4] - Corner[textNewUnitFree, 2]) / 2 + adjuster, true, true)
textMovableOneMile = Text(textOneMileFree, oneMilePoint + (Corner[textOneMileFree, 4] - Corner[textOneMileFree, 2]) / 2 + adjuster, true, true)
textStaticOneMile = Text("$\text{1 mi\vphantom{|}}", textAnchors(5) + (Corner[textOneMileFree, 4] - Corner[textOneMileFree, 2]) / 2 + adjuster, true, true)
textStaticNewUnit = Text(textNewUnitFree, textAnchors(6) + (Corner[textNewUnitFree, 4] - Corner[textNewUnitFree, 2]) / 2 + adjuster, true, true)
textGivenNumerator: "\text{" + (LaTeX[givenSpeed]) + " " + (LaTeX[oneMileChanging]) + "}"
fractionBar2Start: (150, fractionBarYCoord)
fractionBar2 = Segment(fractionBar2Start, fractionBar2Start + (boxHorizontalPixels, 0))
fractionBar3Start: (308, fractionBarYCoord)
fractionBar1Start: (57, fractionBarYCoord)
fractionBar1 = Segment(fractionBar1Start, fractionBar1Start + (50, 0))
fractionBar3 = Segment(fractionBar3Start, fractionBar3Start + (150, 0))
dot = Text("$\text{\bold{\cdot}}", (121, fractionBarYCoord + 10), true, true)
textAnswerEqualsSign1 = Text("$\text{=}", (270, fractionBarYCoord + 12), true, true)
answerStep1Location = Midpoint(fractionBar3)
textWrongNumeratorLongFree: "\text{\vphantom{|}" + (LaTeX[givenSpeed]) + " mi \cdot 1 mi}"
textWrongDenominatorLongFree: "\text{\vphantom{|}1 hr \cdot " + (LaTeX[textStaticNewUnit]) + "}"
textRightNumeratorLongFree: "\text{\vphantom{|}" + (LaTeX[givenSpeed]) + " \cdot " + (LaTeX[textStaticNewUnit]) + "}"
textRightNumeratorLong = Text(textRightNumeratorLongFree, answerStep1Location + (Corner[textRightNumeratorLongFree, 4] - Corner[textRightNumeratorLongFree, 2]) / 2 + adjuster + (0, 25), true, true)
textRightDenominatorLong = Text(textGivenDenominator, answerStep1Location + (Corner[textGivenDenominator, 4] - Corner[textGivenDenominator, 2]) / 2 + adjuster + (0, -25), true, true)
textWrongNumeratorShortFree: "\text{\vphantom{|}" + (LaTeX[givenSpeed]) + " mi^{2}}"
textWrongDenominatorShortFree: "\text{\vphantom{|}" + (LaTeX[conversionFactorText]) + " hr}\cdot\text{" + (LaTeX[newUnitAbbr]) + "}}"
showShortAnswer = false
started = false
maxTries: 2
labelBtnValidate: "\text{CHECK (" + (LaTeX[maxTries - tries]) + ")}"
textAnswerEqualsSign2 = Text("$\text{=}", (476, fractionBarYCoord + 12), true, true)
rightAnswerText = Text(If[rightAnswerNumber ≥ 1000, "$\text{" + (Mod[rightAnswerNumber, 1000]) + "," + ((Div[rightAnswerNumber, 1000] * "}")), "\text{" + rightAnswerNumber + "}"], (0, 0), true, true)
textRightNumeratorShort = Text(textRightNumeratorShortFree, answerStep2Location + (Corner[textRightNumeratorShortFree, 4] - Corner[textRightNumeratorShortFree, 2]) / 2 + adjuster + (0, 25), true, true)
textRightDenominatorShort = Text(textGivenDenominator, answerStep2Location + (Corner[textGivenDenominator, 4] - Corner[textGivenDenominator, 2]) / 2 + adjuster + (0, -25), true, true)
delete: rightAnswerNumber ≥ 1000
textWrongDenominatorLong = Text(textWrongDenominatorLongFree, answerStep1Location + (Corner[textWrongDenominatorLongFree, 4] - Corner[textWrongDenominatorLongFree, 2]) / 2 + adjuster + (0, -23), true, true)
textWrongDenominatorShort = Text(textWrongDenominatorShortFree, answerStep2Location + (Corner[textWrongDenominatorShortFree, 4] - Corner[textWrongDenominatorShortFree, 2]) / 2 + adjuster + (0, -23), true, true)
textWrongNumeratorLong = Text(textWrongNumeratorLongFree, answerStep1Location + (Corner[textWrongNumeratorLongFree, 4] - Corner[textWrongNumeratorLongFree, 2]) / 2 + adjuster + (0, 23), true, true)
textWrongNumeratorShort = Text(textWrongNumeratorShortFree, answerStep2Location + (Corner[textWrongNumeratorShortFree, 4] - Corner[textWrongNumeratorShortFree, 2]) / 2 + adjuster + (0, 23), true, true)
textTopEqualsSign: "\text{" + (LaTeX[If[unitSelector > 2, "≈", "="]]) + "}"
helpTextHint: "
\color[rgb]{.78,.31,0} \text{\bold{Hint}} \\

\color[rgb]{.145,.145,.145} \text{Choose a conversion factor that will result in " + (LaTeX[newUnit]) + " per hour.}"
readyToCheck: showbuttons ∧ tries < maxTries ∧ (¬(validate ∧ correct))
A = (700, 287)
B: A + (50, 0)
textSolution: "\text{\bold{Solution}}\\
\text{\frac{" + (LaTeX[givenSpeed]) + " " + (LaTeX[textOneMileStrikeThrough]) + "}{1 hr}\cdot\frac{" + (LaTeX[textNewUnitFree]) + "}{1 " + (LaTeX[textOneMileStrikeThrough]) + "}=\frac{" + (LaTeX[textRightNumeratorLongFree]) + "}{1 hr \cdot1}=\frac{" + (LaTeX[textRightNumeratorShortFree]) + "}{" + (LaTeX[textRightDenominatorShort]) + "}}\\
\\\\\\
\text{\bold{\vphantom{|}" + (LaTeX[If[rightAnswerNumber ≥ 1000, textRightNumeratorWithComma, textRightNumeratorNoComma]]) + " " + (LaTeX[newUnit]) + " per hour"
textAnswer: "\text{\vphantom{|}" + (LaTeX[If[rightAnswerNumber ≥ 1000, textRightNumeratorWithComma, textRightNumeratorNoComma]]) + " " + (LaTeX[newUnit]) + " per hour}"
textFeedback: "" + (LaTeX[If[correct, "$\text{\vphantom{,}✓ Correct. You are going " + textAnswer + ".}$", "$\text{\vphantom{,}✕ Maybe next time}$"]]) + ""

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)

Tool: Tool4
Input: A
Output: text1

text1 = Text("text", A)

Tool: Tool5
textBox
Input: countQuestion, adjuster, G, textStaticNewUnit
Output: text3, poly1

unitSelector = 3
conversionFactorText = Element({"5,280", "1,760", "1,609.34", "1.61"}, unitSelector)
newUnitAbbr = Element({"ft", "yd", "m", "km"}, unitSelector)
adjuster: (7, -5)
poly1 = Polygon({G})
text3 = Text(textStaticNewUnit, G + (Corner[textStaticNewUnit, 4] - Corner[textStaticNewUnit, 2]) / 2 + adjuster, true, true)

Tool: Tool6
betterTextBox
Input: boxVerticalPixels, boxHorizontalPixels, textStaticOneMile, adjuster, G
Output: q2, text3

\text{1 mi\vphantom{|}}

boxVerticalPixels: 40
boxHorizontalPixels: 120
adjuster: (7, -5)
q2, n, p, q, r = Polygon(G + (boxHorizontalPixels / 2, boxVerticalPixels / 2), G + (((-boxHorizontalPixels)) / 2, boxVerticalPixels / 2), G + (((-boxHorizontalPixels)) / 2, ((-boxVerticalPixels)) / 2), G + (boxHorizontalPixels / 2, ((-boxVerticalPixels)) / 2))
text3 = Text(textStaticOneMile, G + (Corner[textStaticOneMile, 4] - Corner[textStaticOneMile, 2]) / 2 + adjuster, true, true)

Tool: Tool7
Input: boxVerticalPixels, boxHorizontalPixels, G
Output: q2

boxVerticalPixels: 40
boxHorizontalPixels: 120
q2, n, p, q, r = Polygon(G + (boxHorizontalPixels / 2, boxVerticalPixels / 2), G + (((-boxHorizontalPixels)) / 2, boxVerticalPixels / 2), G + (((-boxHorizontalPixels)) / 2, ((-boxVerticalPixels)) / 2), G + (boxHorizontalPixels / 2, ((-boxVerticalPixels)) / 2))