Given points (1,3) and (1,-4) students need to create a rectangle with an area of 35 sq units. Possible solutions could be (-4,3) and (-4,-4) or it could be (6,3) and (6,-4). Is it possible to have a table be evaluated to be correct when more than one solution is possible?
I want the students to enter their answer as an ordered pair.
Hey Teresa!
First, you can get the coordinates of a pair using the parseOrderedPair
function. More on that here.
Once you have all 4 coordinates, there are many ways to check if they meet your conditions, but the one direct method without using any calculations is to check that the coordinate pairs a student enter matches either of the correct answers and that two different coordinate pairs are entered. Something like:
pair1 = parseOrderedPair( #your first input# )
pair2 = parseOrderedPair( #your first input# )
x1 = numericValue(pair1.x)
y1 = numericValue(pair1.y)
x2 = numericValue(pair2.x)
y2 = numericValue(pair2.y)
isCorrect =
(x1 = x2 and (x2 = -4 or x2 = 6)) and
(y1 = 3 or y1 = -4) and (y2 = 3 or y2 = -4) and
not(y1 = y2)
Shouting from a roof top… THANK YOU SO MUCH!!! I was lost. I am still pretty new at all of this and I fear sometimes I should be able to at least research examples to find the correct coding but sometimes I hit a wall. I believe that my questions are so simple for others, UGH! I really appreciate your help!