In next applet a graph of a random defined first degree function is shown. The user has to select the corresponding equation in a drop-down list. See how it works and make it yourself following the construction steps.
[table][tr][td]1[/td][td][/td][td]Type the command [b]listab=[/b][b]Shuffle[{-3, -2, -1, 1, 2, 3}][/b] to create listab[/td][/tr][tr][td]2-3[/td][td][/td][td]Type the commands [b]a = listab(1)[/b] and [b]b = listab(2)[/b] to create a and b.[/td][/tr][tr][td]4-7[/td][td][/td][td]Define the functions f[sub]1[/sub], f[sub]2[/sub], f[sub]3[/sub] and f[sub]4[/sub] as:[br][b]f1(x) = Polynomial[a x + b], f2(x) = Polynomial[a x - b][br][/b][b]f3(x) = Polynomial[-a x + b], f4(x) = Polynomial[-a x - b][br][/b]Hide the graphs.[/td][/tr][tr][td]8[/td][td][/td][td]Type the command [b]listf={f1, f2, f3, f4}[/b] to create a list that contains the four functions.[/td][/tr][tr][td]9[/td][td][/td][td]Type the command [b]sol = RandomBetween[1, 4][/b] to create the number sol.[/td][/tr][tr][td]10[/td][td][/td][td]Type the command [b]f(x)= Element[listf, sol][/b] to define the function f shown in the Graphics.[/td][/tr][tr][td]11-14[/td][td][icon]/images/ggb/toolbar/mode_text.png[/icon][/td][td]Select the Text Tool and create four dynamic texts with the equations on the functions.[/td][/tr][tr][td]15[/td][td][/td][td]Type the command [b]listans =[/b][b]{"", text1, text2, text3, text4}[/b] and draw it as a drop-down list.[/td][/tr][tr][td]16[/td][td][/td][td]Type the command [b]ans= SelectedIndex[listans] - 1[/b] to create the number ans.[/td][/tr][tr][td]17[/td][td][icon]/images/ggb/toolbar/mode_buttonaction.png[/icon][/td][td]Select the Button Tool and create a button with Caption [b]new exercise[/b] and commands:[br][b]UpdateConstruction[][/b] to recalculate all random defined objects[br][b]SetValue[listans,1][/b] to reset the drop-down list to its initial blank position.[/td][/tr][/table][br]To give feedback you can define the dynamic colors of the list as follows: