Check an absolute value function for correctness

I am needing some assistance with creating a code that will check the absolute value function for correctness. I am looking specifically at slides 6 and 7. Any assistance is greatly appreciated.

Also looking to generate a checkmark in the teacher dashboard.

This from another thread should work just replace any n’s with x’s, and your target function in the graph with your intended answer.

Also in your graph CL, to get the dashboard checkmark:
correct: this.number(`C_{orrect}`)=0

And in your input CL:
readOnly: true

Here is what I created. My code is not working though. Would you mind helping me please?

I tried some additional coding and still can’t get it.

I’m trying some things now. One issue you had was "student input: " typed before the function. Another was readOnly: true was supposed to be in the input not the graph. You don’t won’t a readOnly and correct sink in the same component. readOnly just overrides it and it won’t check anything.

You shouldn’t have anything typed before “function” when you’re creating function(`f`).

For some reason the correct sink wasn’t working in the graph, but here’s what I got for you.

This is exactly what I was trying to do thank you so much. May I pick your brain a little more please? I have added a few more slides. I have where it gives students feedback (this was the review) I am going to remove this component. I can’t figure out on slide 2 and three how to mark it as correct when there are multiple components and how to incorporate the check to assign point values because there is more than one component. I am wanting to assign 0.5 points for each part so a total of 2 points for slide 2 and 3. I also could not figure out how have the check mark for the card sort and assign 3 points for getting it all correct and 0 if not correct.

First, another note on the one I shared. For some reason the initalLatex was not allowing the check to work, so that’s why it’s gone.

To get a dashboard checkmark for a screen with multiple components, you need a correct: sink in each one.

Having “input.submitted” for your first question won’t work because it doesn’t have a submit button. The submit button is from the last component, so “input2.submitted”.

For the points, I would change your checks to equal 0.5 when correct instead of 1, then you can use that value for points a well. I personally prefer to do any correctness checking inside that component, then use that variable for any feedback or whatever elsewhere. So, for your first input (not the note) on slide 2:

check=when numericValue(myPair.x)=-4 and numericValue(myPair.y)=-3  0.5
      otherwise 0
correct: check=0.5

Then in your note for input:

content: when not(input2.submitted) ""
         when input.script.check=0.5  "Great job!"
         otherwise "Check your work to see if you can find your mistake." 

Let’s start with that.