For creating an Exercise just start the "New Exercise" dialog and create or choose a "User defined Tool" which corresponds to the output object the student should construct. In most cases it's best to use only the inputs suggested by the dialog but if you change the input objects choose wisely and test with different possible constructions. Use the "Check" button for this. If you can avoid semi-defined input object, such as point on path, chances for reliability of the test are higher.
If you have more than one Assignment (user defined tool) in your construction, note that the fractions just add up. This is useful if there is one output which is the solution and has 100% and the other assignments are just intermediate steps which are possibly wrong in the end but the solution is correct (for example if the student chose another way of constructing the same object).
As you can see in the rectangle construction below the user defined tools and the Exercises have been created using one tool for the intersection point of a parallel and a perpendicular line to the Segment and one for the rectangle. If the student constructs the Rectangle with a Circle and 2 Lines he will never hit the point in the construction where he has to intersect two lines. In this case we want to give him full credit for the rectangle and partial credit for the intersection point. If we want to force the same construction we would give him partial credit for the rectangle and the other for the intersection point.
The JavaScript Code for checking this example:
/* * This function creates some outputs depending on the result. */ function check() { //save the return object of ggbApplet.getExerciseResult() var exresult = ggbApplet.getExerciseResult(); document.getElementById('feedback').innerHTML = ''; var fractionsum = 0; // if a part of the result has a fraction of 1 ignore the other results var singleCorrectIgnoreOthers = false; for (key in exresult) { if (0.999 < exresult[key].fraction) { singleCorrectIgnoreOthers = true; var feedback = document.createElement("p"); if (exresult[key].hint != "") { feedback.appendChild(document.createTextNode(exresult[key].hint)); } else { feedback.appendChild(document.createTextNode(exresult[key].result)); } document.getElementById('feedback').appendChild(feedback); fractionsum += exresult[key].fraction; } } if (!singleCorrectIgnoreOthers) for (key in exresult) { var feedback = document.createElement("p"); if (exresult[key].hint != "") { feedback.appendChild(document.createTextNode(exresult[key].hint)); } else { feedback.appendChild(document.createTextNode(exresult[key].result)); } document.getElementById('feedback').appendChild(feedback); fractionsum += exresult[key].fraction; } if (0.999 < fractionsum) { document.getElementById('feedback').appendChild(document.createTextNode("You got " + 100 + " Points out of 100.")); } else { document.getElementById('feedback').appendChild(document.createTextNode("You got " + fractionsum * 100 + " Points out of 100.")); } var resultText = document.createElement("p"); resultText.appendChild(document.createTextNode("The output of ggbApplet.getExerciseResult() was: ")); document.getElementById('feedback').appendChild(resultText); var resultObj = document.createElement("pre"); resultObj.innerHTML=JSON.stringify(exresult, null, 4); document.getElementById('feedback').appendChild(resultObj); }