(* ::Package:: *) BeginPackage["SymbolicExams`"]; (* Author Dara O Shayda, Nov 2012 - Present *) (* License http://www.apache.org/licenses/LICENSE-2.0.html *) qPanel1::usage = "Simplest possible calculation panel"; qPanel2::usage = "Simplest possible calculation panel"; qPanel3::usage = "Simplest possible calculation panel"; qPanel4::usage = "Simplest possible calculation panel"; qPanel5::usage = "Simplest possible calculation panel"; qPanel5Rev::usage = "Simplest possible calculation panel"; qPanel5Diag::usage = "Simplest possible calculation panel"; qPanel6::usage = "Simplest possible calculation panel"; qPanel6Diag::usage = "Simplest possible calculation panel"; qPanel6Rev::usage = "Simplest possible calculation panel"; qPanel7::usage = "Simplest possible calculation panel"; qPanel7Diag::usage = "Simplest possible calculation panel"; qPanel7Rev::usage = "Simplest possible calculation panel"; qPanel8::usage = "Simplest possible calculation panel"; qPanel8Diag::usage = "Simplest possible calculation panel"; qPanel8Rev::usage = "Simplest possible calculation panel"; qPanel9::usage = "Simplest possible calculation panel"; qPanel10::usage = "Simplest possible calculation panel"; qPanel11::usage = "Simplest possible calculation panel"; qPanel12::usage = "Simplest possible calculation panel"; qPanel13::usage = "Simplest possible calculation panel"; qPanel14::usage = "Simplest possible calculation panel"; qPanel15::usage = "Simplest possible calculation panel"; qPanel16::usage = "Simplest possible calculation panel"; qPanel17::usage = "Simplest possible calculation panel"; qPanel18::usage = "Simplest possible calculation panel"; qPlot1::usage = "Matching plots to line equations"; qPlot2::usage = "Matching plots to line equations"; qPlotLine3::usage = "Matching plots to line equations"; qPlotLine4::usage = "Matching plots to line equations"; qPlotLineSlope1::usage = "Plots a line given a point and slope"; qPlotLine2Points1::usage = "Plots a line give two points "; qPlotLineMXB1::usage = "Plots mx + b"; qPanelExpr1::usage = "Input fields are placed for expressions, and the inputed expressions are tested for validity"; qPanelExpr2Diag::usage = "Input fields are placed for expressions, and the inputed expressions are tested for validity"; qPanelExpr2Rev::usage = "Input fields are placed for expressions, and the inputed expressions are tested for validity"; qPanelExpr2::usage = "Input fields are placed for expressions, and the inputed expressions are tested for validity"; qPanelExpr3::usage = "Input fields are placed for expressions, and the inputed expressions are tested for validity"; qPanelExpr3Rev::usage = "Input fields are placed for expressions, and the inputed expressions are tested for validity"; qPanelExpr3Diag::usage = "Input fields are placed for expressions, and the inputed expressions are tested for validity"; qPanelExpr4::usage = "Input fields are placed for expressions, and the inputed expressions are tested for validity"; qPanelExpr4Rev::usage = "Input fields are placed for expressions, and the inputed expressions are tested for validity"; qPanelExpr4Diag::usage = "Input fields are placed for expressions, and the inputed expressions are tested for validity"; qPanelExpr1Rev::usage = "review test"; qPanelExpr1Diag::usage = "actual scoring"; qPanelExprFrac1::usage = "Simplify Fractions"; qPanelFrac1::usage = "Simplify Fractions multiple choice"; qPanelFrac1v2::usage = "Simplify Fractions multiple choice"; qPanelFrac1v3::usage = "Simplify Fractions multiple choice"; qPanelFrac2::usage = "Which fractions are same"; qPanelFrac3::usage = "Rate of change and Fraction"; qPanelFrac4::usage = "Multiplication of Fractions"; qPanelFrac5::usage = "Divide Fractions"; qPanelFrac6::usage = "add a bunch of fractions"; qPanelFracRadical1::usage = "Radical fractions"; qInit::usage = "init stats"; qStart::usage = "start exam"; qPrint::usage = "Print exam clicks"; qStats::usage = "stats for exam clicks"; qSend::usage = "Send the clicks out"; qSendLocal::usage = "Send the clicks out"; qSendClicksNB::usage = "Send answers via E cdf"; qFetchNB::usage = "FETCH URL SOLUTION by Wayne Allen"; readName::usage="Get student name"; readTitle::usage="Setup LOGO"; Begin["`Private`"]; (* Specifications per exam *) examIDString = "\!\(\* StyleBox[\"SOC411\",\nFontWeight->\"Bold\"]\)\!\(\* StyleBox[\",\",\nFontWeight->\"Bold\"]\)\!\(\* StyleBox[\" \",\nFontWeight->\"Bold\"]\)\!\(\* StyleBox[\"Jan\",\nFontWeight->\"Bold\"]\)\!\(\* StyleBox[\" \",\nFontWeight->\"Bold\"]\)\!\(\* StyleBox[\"13\",\nFontWeight->\"Bold\"]\)\!\(\* StyleBox[\" \",\nFontWeight->\"Bold\"]\)\!\(\* StyleBox[\"2014\",\nFontWeight->\"Bold\"]\)\!\(\* StyleBox[\",\",\nFontWeight->\"Bold\"]\)\!\(\* StyleBox[\" \",\nFontWeight->\"Bold\"]\)\!\(\* StyleBox[\"Prof\",\nFontWeight->\"Bold\"]\)\!\(\* StyleBox[\".\",\nFontWeight->\"Bold\"]\)\!\(\* StyleBox[\" \",\nFontWeight->\"Bold\"]\)\!\(\* StyleBox[\"Andie\",\nFontWeight->\"Bold\"]\)\!\(\* StyleBox[\" \",\nFontWeight->\"Bold\"]\)\!\(\* StyleBox[\"Noak\",\nFontWeight->\"Bold\"]\)\n\!\(\* StyleBox[\"\[Copyright]\",\nFontWeight->\"Bold\"]\)\!\(\* StyleBox[\" \",\nFontWeight->\"Bold\"]\)\!\(\* StyleBox[\"Ryerson\",\nFontWeight->\"Bold\"]\)\!\(\* StyleBox[\" \",\nFontWeight->\"Bold\"]\)\!\(\* StyleBox[\"2014\",\nFontWeight->\"Bold\"]\)"; examIDString2 = "SOC411, Jan 13 2014, Prof. Andie Noak"; examName = "Percents Module"; examName2 = "Percents"; qMagnification = 1.2; bigNumber = 1000102010004455; (* [[2]] told me, I told [[3]], [[4]] book, it is all [[5]] *) qNamesList={{"Boza", "he", "him", "his", "his"}, {"Dara", "he", "him", "his", "his"} , {"Jack", "he", "him", "his", "his"}, {"Ginger", "she", "her", "her", "hers"}, {"Wayne", "he", "him", "his", "his"}, {"Spomenka", "she", "her", "her", "hers"}, {"George", "he", "him", "his", "his"}, {"Kevin", "he", "him", "his", "his"}, {"Tina", "she", "her", "her", "hers"}, {"Lucia", "she", "her", "her", "hers"}, {"Ahmad", "he", "him", "his", "his"},{"Abaz", "he", "him", "his", "his"}}; qRandList[list0_]:=list0[[RandomInteger[{1, Length[list0]}]]] qCaps[x0_]:=Module[{x=x0}, x=Characters[x]; StringJoin[Join[{ToUpperCase[x[[1]]]}, Drop[x,1]]] ] (* FIXME: all useless or need to be fixed *) qInit[]:= Module[{}, (* {clickNum, problemType, tryAgain, totalClicks} *) Table[qClicks [[i]][[1]] = 0;qClicks [[i]][[4]]=0;qClicks [[i]][[3]]=True,{i , 1, Length[qClicks]}]; studentID=" "; ] (* only counts the True click *) qClick[n0_]:=DynamicModule[{n=n0}, (*qClicks[[n]][[2]] = 1;*) qAppend[{n,1,0}]; ] qClickPlus[n0_]:=DynamicModule[{n=n0}, (*qClicks[[n]][[3]] = 1;*) qAppend[{n,0,1}]; ] qNum = 0; (* number of questions *) (*FIXME: OBSOLETE *) (* best put this after making ABCD to FALSE *) qTryAgain[n0_]:= Module[{n=n0}, (*qClicks[[n]][[3]] = True;*) n=n; ] qTryAgainNOT[n_]:="" qStart[]:= Button["Start", qInit[]] qPrint[]:=Button["Results",Print[FromDigits[ToCharacterCode[Compress[qClicks]],1000]]] qStats[]:=Module[{body}, OpenerView[Button["Grade", Panel[Grid[Transpose[body],Alignment->Left]]], True] ] qAppend[text_]:=Module[{s,fname}, (*fname=FileNameJoin[{$TemporaryDirectory,StringReplace[DateString[], {" "->"_", ":"->"_"}]<>"symbolix.txt"}];*) fname=FileNameJoin[{$UserDocumentsDirectory,"DARADARADARA"<>"symbolix.txt"}]; s=OpenAppend[fname]; Write[s,text]; {Close[s], fname} ] qFlushLAN[text_, id_, path_] := Module[{s, fname}, (*fname=FileNameJoin[{$TemporaryDirectory,StringReplace[ DateString[], {" "->"_", ":"->"_"}]<>"symbolix.txt"}];*) fname = FileNameJoin[{path, If[id === "", "NOID", id] <> StringReplace[DateString[], {" " -> "_", ":" -> "_"}] <> "symbolix.txt"}]; s = OpenWrite[fname]; Write[s, text]; {Close[s], fname} ] qFlush2[dir_, prefix_,text_]:=Module[{s,fname}, fname=FileNameJoin[{dir,prefix<>"symbolix.txt"}]; s=OpenWrite[fname]; Write[s,text]; Close[s] ] qFlushLAN2[text_]:=Module[{s,fname}, fname=FileNameJoin[{"\\\\trinity.arts.ryerson.ca\\artslabshare\\dropbox","symbolix.txt"}]; s=OpenWrite[fname]; Write[s,text]; Close[s] ] qFlush2[dir_, prefix_,text_]:=Module[{s,fname}, fname=FileNameJoin[{dir,prefix<>"symbolix.txt"}]; s=OpenWrite[fname]; Write[s,text]; Close[s] ] writeID[id_]:=Module[{s,fname}, fname=FileNameJoin[{$UserDocumentsDirectory,"id"<>"symbolix.txt"}]; s=OpenWrite[fname]; Write[s,id]; {Close[s], fname}; ] readID[]:=Module[{s,fname}, fname=FileNameJoin[{$UserDocumentsDirectory,"id"<>"symbolix.txt"}]; Off[Import::nffil]; If[Import[fname,"Text"]===$Failed, "",Import[fname,"Text"]] ] qSend[]:=Module[{status="",a, body,text,ret1,ret2,tmp="",msg,g, res=False, track,g2, res2}, Manipulate[ g=qClicks; g2 = Refresh[CheckboxBar[Range[qNum]*qClicks[[1;;qNum,2]],Range[qNum], Appearance->"Vertical",Enabled->False],UpdateInterval->1]; text=Dynamic[If[TrueQ[studentID==""], "Student Unidentified", "ID="<>studentID]<>"\n"<>status]; body={{Dynamic[If[res==True,Text[Style["Checked Marks Indicate Correct Answers\n"<>"\nTo Track this test: email "<>ToString[track]<>" to Deidre Lam \n",Red,Background->Yellow]], ""]],Dynamic[If[res==True,g2, ""]], Dynamic[Which[(Mean[g[[1;;qNum,2]]] > 0.8)&& (res == True), "\n\!\(\* StyleBox[\"Congratulations\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"!\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"You\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"passed\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"the\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"Integers\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"module\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\".\",\nFontColor->RGBColor[1, 0, 0]]\)\n\!\(\* StyleBox[\"Grade\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\":\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)"<>ToString[Ceiling[qTrunc4[Mean[g[[1;;qNum,2]]]]*100]],(Mean[g[[1;;qNum,2]]] < 0.8)&& (res == True), "\n \!\(\* StyleBox[\"Please\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"study\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"the\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)"<> examName <>" \!\(\* StyleBox[\"and\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"write\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"this\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"test\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"again\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\".\",\nFontColor->RGBColor[1, 0, 0]]\)\n\!\(\* StyleBox[\"Grade\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\":\",\nFontColor->RGBColor[1, 0, 0]]\) "<>ToString[Ceiling[qTrunc4[Mean[g[[1;;qNum,2]]]]*100]],True,""]] },{"","",""}}; Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left,Spacings->{4,0.5}(*,ItemSize->20)*)],text,ImageMargins->1],DefaultOptions->{InputField->{ContinuousAction->True},FontSize->Large}]], {{a, 0,""}, Button["Send Answers",res=True;res2=qFlushLAN[studentID<>" , "<>examName2<>" , "<>ToString[Ceiling[qTrunc4[Mean[qClicks[[1;;qNum,2]]]]*100]]<>" , "<>ToString[qClicks]<>" , "<>examIDString2<>" , "<>DateString[]<>" , "<>ToString[track]<>" , "<>IntegerString[Hash[ToString[track]<>"gilan1339","MD5"],16]];status="Answers Sent, Good Luck!\n"<>ToString[res2]; Clear["Global`*"];ClearAll[qClickPlus,qClick,readName] ] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}};track=RandomInteger[{100000,900000}])] ] readTitle[logo_,course_,prof_]:=DynamicModule[{x="",a, body,inputs, text=Null,studentID}, Manipulate[ Pane@"", "", TrackedSymbols->Manipulate, SaveDefinitions->True,AppearanceElements->None,SynchronousUpdating->False, Initialization:>(Off[Import::nffil];Off[DeleteFile::nffil];qClicks = {{1, 0, -1, ""}, {2, 0, -1, ""}, {3, 0, -1, ""}, {4, 0, -1, ""}, {5, 0, -1, ""}, {6, 0, -1, ""},{7, 0, -1, ""},{8, 0, -1, ""},{9, 0, -1, ""},{10, 0, -1, ""}};qNum=0;studentID=""; DeleteFile[FileNameJoin[{$UserDocumentsDirectory,"DARADARADARA"<>"symbolix.txt"}]];DeleteFile[FileNameJoin[{$UserDocumentsDirectory,"id"<>"symbolix.txt"}];qNum=0;](*If[DayCount[dateIssued, DateList[]] > experationInterval, Exit[]];*);SetOptions[EvaluationNotebook[],PrivateNotebookOptions->{"PluginToolbarEnabled"->False}, DockedCells->Cell[BoxData[ToBoxes[Row[{Column[{Image[logo,ImageSize->200],course, prof},ItemSize->{20,Automatic}],PopupMenu[Dynamic[CurrentValue[EvaluationNotebook[],"Magnification"]],Range[0.5,3,0.5]]},Spacer[5]]]],"DockedCell"]];),Paneled->False] ] qSendLocal2[dir_]:=Module[{status="",a, body,text,ret1,ret2,tmp="",msg,g, res=False, track}, Manipulate[ g=qClicks; g2 = Refresh[CheckboxBar[Range[qNum]*qClicks[[1;;qNum,2]],Range[qNum], Appearance->"Vertical",Enabled->False],UpdateInterval->1]; text=Dynamic[If[TrueQ[studentID==""], "Student Unidentified", "ID="<>studentID]<>"\n"<>status]; body={{Dynamic[If[res==True,Text[Style["Checked Marks Indicate Correct Answers\n",Red]], ""]],Dynamic[If[res==True,g2, ""]], Dynamic[Which[(Mean[g[[1;;qNum,2]]] > 0.8)&& (res == True), "\n\!\(\* StyleBox[\"Congratulations\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"!\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"You\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"passed\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"the\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"Integers\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"module\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\".\",\nFontColor->RGBColor[1, 0, 0]]\)\n\!\(\* StyleBox[\"Grade\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\":\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)"<>ToString[Ceiling[qTrunc4[Mean[g[[1;;qNum,2]]]]*100]],(Mean[g[[1;;qNum,2]]] < 0.8)&& (res == True), "\n \!\(\* StyleBox[\"Please\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"study\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"the\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)"<> examName <>" \!\(\* StyleBox[\"and\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"write\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"this\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"test\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"again\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\".\",\nFontColor->RGBColor[1, 0, 0]]\)\n\!\(\* StyleBox[\"Grade\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\":\",\nFontColor->RGBColor[1, 0, 0]]\) "<>ToString[Ceiling[qTrunc4[Mean[g[[1;;qNum,2]]]]*100]],True,""]] },{"","",""}}; Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left,Spacings->{4,0.5}(*,ItemSize->20)*)],text,ImageMargins->1],DefaultOptions->{InputField->{ContinuousAction->True},FontSize->Large}]], {{a, 0,""}, Button["Send Answers",res=True;res2=qFlush2[dir, studentID<> StringReplace[DateString[], {" "->"_", ":"->"_"}],studentID<>" , "<>examName2<>" , "<>ToString[Ceiling[qTrunc4[Mean[g[[1;;qNum,2]]]]*100]]<>" , "<>ToString[qClicks]<>" , "<>examIDString2<>" , "<>DateString[]];status="Answers Sent, Good Luck!\n"; Clear["Global`*"];ClearAll[qClickPlus,qClick,readName] ] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] ] qSendLocal[path_,name_]:=DynamicModule[{status="",a, body,text,ret1,ret2,tmp="",msg,res=False, track,res2,arg,Gg2, Gg3={},qClicks,q,first=True,studentID="", buttonEnable=False ,resF ,ID}, Manipulate[ (*Refresh[If[first==True,studentID=readID[], If[readID[]==="",studentID,studentID=readID[]]],UpdateInterval->1];*) text=Dynamic[status]; buttonEnable=Dynamic[If[studentID!="", True]]; body={{Dynamic[If[res==True,Text[Style["Checked Marks Indicate Correct Answers\n"<>"\nTo Track this test: email "<>ToString[track]<>", "<>IntegerString[Hash[ToString[Gg2]<>ToString[track]<>"Mehran1339","MD5"],16]<>" to Deidre Lam \n"<>"Test results stored in file: "<>res2[[2]],Red,Background->Yellow]], ""]],Dynamic[If[res==True,CheckboxBar[Range[qNum]*Gg3,Range[qNum], Appearance->"Vertical",Enabled->False], ""]], Dynamic[Which[(Length[Gg3]-Total[Gg3]<=1)&& (res == True), "\n\!\(\* StyleBox[\"Congratulations\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"!\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"You\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"passed\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"the\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)"<> examName <>" \!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"..\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\".\",\nFontColor->RGBColor[1, 0, 0]]\)\n\!\(\* StyleBox[\"Grade\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\":\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)"<>ToString[Ceiling[qTrunc4[Mean[Gg3]]*100]],(Length[Gg3]-Total[Gg3]>1)&& (res == True), "\n \!\(\* StyleBox[\"Please\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"study\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"the\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)"<> examName <>" \!\(\* StyleBox[\"and\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"write\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"this\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"test\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\"again\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\".\",\nFontColor->RGBColor[1, 0, 0]]\)\n\!\(\* StyleBox[\"Grade\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\* StyleBox[\":\",\nFontColor->RGBColor[1, 0, 0]]\) "<>ToString[Ceiling[qTrunc4[Mean[Gg3]]*100]],True,""]]},{"","",""}}; Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left,Spacings->{4,0.5}(*,ItemSize->20)*)],text,ImageMargins->1],DefaultOptions->{InputField->{ContinuousAction->True},FontSize->Large}]], {{a, 0,""}, Column[{InputField[Dynamic[studentID], String, ContinuousAction->True,FieldHint->"Enter your ID"],Style[Dynamic[ Button["Send Answers",Off[Import::nffil];Off[DeleteFile::nffil]; If[ first == True,q=Import[FileNameJoin[{$UserDocumentsDirectory,"DARADARADARA"<>"symbolix.txt"}],"List"]; Gg2=DeleteDuplicates[Table[ToExpression[q[[i]]],{i, 1, Length[q]}]]; Table[qClicks[[Gg2[[i]][[1]]]]=Gg2[[i]],{i,1 Length[Gg2]}]]; Gg2=qClicks[[1;;qNum]]; Gg3=Gg2[[1;;qNum,2]]; res=True; arg=studentID<>" , "<>examName2<>" , "<>ToString[Ceiling[qTrunc4[Mean[Gg3]]*100]]<>" , "<>ToString[Gg2]<>" , "<>examIDString2<>" , "<>DateString[]<>" , "<>ToString[track]<>" , "<>IntegerString[Hash[ToString[Gg3]<>ToString[track]<>"gilan1339","MD5"],16];res2=qFlushLAN[arg,studentID,path]; resF=URLFetch["http://symbolicexams.lossofgenerality.com/wp-content/plugins/test-receiver/results.php","Parameters"->{"results"->studentID<>" , "<>examName2<>" , "<>ToString[Ceiling[qTrunc4[Mean[Gg3]]*100]]<>" , "<>ToString[Gg2]<>" , "<>examIDString2<>" , "<>DateString[]<>" , "<>ToString[track]<>" , "<>IntegerString[Hash[ToString[Gg3]<>ToString[track]<>"Mehran1339","MD5"],16]},"ReadTimeout"->10,"ConnectTimeout"->50,"Method"->"POST"]; (*qLog[ToString[resF],studentID];*) status=If[resF===$Failed,"Failure to Send Answers, see MY DOCUMENTS for results file\nTake snapshot of the screen","Answers Sent, Good Luck!\n"];If[ first==True,DeleteFile[FileNameJoin[{$UserDocumentsDirectory,"DARADARADARA"<>"symbolix.txt"}]]];first=False;DeleteFile[FileNameJoin[{$UserDocumentsDirectory,"id"<>"symbolix.txt"}]];(*<>ToString[res2[[1]]]*)(*Clear["Global`*"];ClearAll[qClickPlus,qClick,readName]*),Method->"Queued" ,Enabled->buttonEnable]],DynamicEvaluationTimeout->1000000] }]&}, TrackedSymbols->Manipulate, SaveDefinitions->True,AppearanceElements->None,SynchronousUpdating->False,ContinuousAction->False, Initialization:>(track=RandomInteger[{100000,900000}];qClicks = {{1, 0, -1, ""}, {2, 0, -1, ""}, {3, 0, -1, ""}, {4, 0, -1, ""}, {5, 0, -1, ""}, {6, 0, -1, ""},{7, 0, -1, ""},{8, 0, -1, ""},{9, 0, -1, ""},{10, 0, -1, ""}};first=True;studentID="";buttonEnable=False;Gg3={};examName2=name;examName=name; examIDString2=name;)] ] (* xxxNB only works for notebooks and not CDF *) (* Currently there is a problem with SendMail[] in Mathematica 9.0 *) qSendNB[]:=Button["Send Answers",SendMail["To"->"dara@lossofgenerality.com","Subject"->"Example Message from CDF","Body"->ToString[qClicks],"UserName"->"symbolicexams@gmail.com","Server"->"smtp.gmail.com","Password"->"gilangilangilan", "PortNumber"->465,"EncryptionProtocol"->"SSL"]] qSendClicksNB[]:=DynamicModule[{status="",a, body,text,ret1,ret2}, Manipulate[ text=Dynamic[If[TrueQ[status==""], "", status]]; body={{Text[Style["Check your student ID",Red]],""},{"",""}}; Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left,Spacings->{4,0.5}(*,ItemSize->20)*)],text,ImageMargins->1],DefaultOptions->{InputField->{ContinuousAction->True},FontSize->Large}]], {{a, 0,""}, Button["Send Answers",ret1=SendMail["To"->"dara@lossofgenerality.com","Subject"->"Example Message from CDF","Body"->ToString[qClicks],"UserName"->"symbolicexams@gmail.com","Server"->"smtp.gmail.com","Password"->"gilangilangilan", "PortNumber"->465,"EncryptionProtocol"->"SSL"];status="Answers Sent, Good Luck!"<>ToString[ret1]] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] ] qFetchNB[]:=DynamicModule[{status="",a, body,text,ret1,ret2}, (* Button["Send Answers",ret2=URLFetch["mathematica.lossofgenerality.com/test.php","Parameters"->{"Student"->ToString[studentID],"Exam"->"TBD","Clicks"->ToString[qClicks]},"ReadTimeout"->10,"ConnectTimeout"->10];status="Answers Sent, Good Luck!"<>ToString[ret1]] *) Manipulate[ text=Dynamic[If[TrueQ[status==""], "", status]]; body={{Text[Style["Check your student ID",Red]],""},{"",""}}; Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left,Spacings->{4,0.5}(*,ItemSize->20)*)],text,ImageMargins->1],DefaultOptions->{InputField->{ContinuousAction->True},FontSize->Large}]], {{a, 0,""}, Button["Send Answers",ret2=URLFetch["mathematica.lossofgenerality.com/test.php","Parameters"->{"Student"->ToString[studentID],"Exam"->"TBD","Clicks"->ToString[qClicks]},"ReadTimeout"->10,"ConnectTimeout"->10];status="Answers Sent, Good Luck!"(*<>ToString[ret1]*)] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] ] readName[]:=DynamicModule[{x="",a, body,inputs, text=Null}, studentID=""; qNum=0; Manipulate[ (* If has to use TrueQ[]!!! *) text=Dynamic[If[TrueQ[x==Null], "", "ID Registered: "<>studentID]]; inputs=InputField[Dynamic[x], String, FieldHint->"Enter your ID"]; body={{inputs,Text[Style[examName<>"\n"<>examIDString,Red]]},{"",""}}; Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left,Spacings->{4,0.5}(*,ItemSize->20)*)],text,ImageMargins->1],DefaultOptions->{InputField->{ContinuousAction->True},FontSize->Large}]], {{a, 0,""}, Button["Press To Register ID", studentID = x]&}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None, Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}};qNum=0)] ] qSign[a0_]:=Which[a0>0, "+"<>ToString[Abs[a0]], a0<0, "-"<>ToString[Abs[a0]], a0==0, "0"] qSign2[a0_]:=Which[a0>0, "+", a0<0, "-", a0==0, ""] qTrunc1[a0_]:=If[IntegerQ[Ceiling[100*a0]/100], Ceiling[100*a0]/100, N[Ceiling[100*a0]/100]] qTrunc2[a0_]:=N[Floor[100*a0]/100] qTrunc3[a0_]:=N[Ceiling[10*a0]/10] qTrunc4[a0_]:=N[Floor[10*a0]/10] qTrunc5[a0_]:=N[Round[10*a0]/10] solutionPanelExpr1[a0_,b0_,c0_,d0_]:= Module[{a=a0,b=b0,c=c0,d=d0, body}, body={{ Text["("<>ToString[a]<>"-("<>ToString[b]<>"-("<>ToString[c]<>"-"<>ToString[d]<>")))"], Text["="<>ToString[a]<>"-("<>ToString[b]<>"-("<>ToString[c-d]<>"))"], Text["="<>ToString[a]<>"-("<>ToString[b-(c-d)]<>")"], Text["="<>ToString[a-(b-(c-d))]<>"\n\n"], Text["("<>ToString[a]<>" - "<>ToString[b]<>") - ("<>ToString[c]<>" + "<>ToString[d]<>")"], Text["=("<>ToString[a]<>" - "<>ToString[b]<>") - ("<>ToString[c+d]<>")"], Text["=("<>ToString[a-b]<>") - ("<>ToString[c+d]<>")"], Text["="<>ToString[(a-b)-(c+d)]<>"\n\n"], Text["-"<>ToString[a]<>" - ( - "<>ToString[b]<>")"], Text["=-"<>ToString[a]<>" + ("<>ToString[b]<>")"], Text["="<>ToString[-a-(-b)]<>"\n\n"], Text["("<>ToString[a]<>" - "<>ToString[b]<>") - "<>ToString[c]], Text["=("<>ToString[a-b]<>") - "<>ToString[c]], Text["="<>ToString[(a-b)-c]] },{Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null}}; Panel[Grid[Transpose[body],Alignment->Left]] ] hintPanelExpr1[a0_,b0_,c0_,d0_]:=Module[{a=a0,b=b0,c=c0,d=d0, body}, body={{ Text["("<>ToString[a]<>"-("<>ToString[b]<>"-("<>ToString[c]<>"-"<>ToString[d]<>")))"<>" has the expression form a-(b-(c-d)) \n"], Text["Where a = "<>ToString[a]<>", b = "<>ToString[b]<>", c = "<>ToString[c]<>", and d = "<>ToString[d]<>"\n"], Text["Expand the expression into a-b+c-d\n"] },{Null,Null,Null}}; Panel[Grid[Transpose[body]],ImageSize->300] ] qPaneHintExpr1[a_,b_,c_,d_]:="Think \"BEDMAS\"" qPanelExpr1[pn0_,a0_,b0_,c0_,d0_,hint0_,diag0_]:= DynamicModule[{pn=pn0,text,hint=hint0,A2=bigNumber,B2=bigNumber,C2=bigNumber,D2=bigNumber,A1=Null,B1=Null, C1=Null, D1=Null,answer,a=a0,b=b0,c=c0,d=d0,myEnabled=True,text2,body, expers, answers,answersShuffled,expersShuffled,index,answerStudent,tryAgain=True, state=False, diag=diag0 ,xxx,stateH=False}, qNum += 1; If[diag==False, Style[Manipulate[ xxx=xxx; text2={ToString[pn]<>". "<>"Simplify each of the following"}; answer="?"; (* If for the Null testhing has to be inside the dynamic *) (* FIXME: RunScheduledTask does not work correctly if the DynamicModule used *) answerStudent= Dynamic[A2=If[TrueQ[A1==Null], bigNumber,A1];B2=If[TrueQ[B1==Null], bigNumber,B1];C2=If[TrueQ[C1==Null], bigNumber,C1];D2=If[TrueQ[D1==Null], bigNumber,D1]; Which [A2==((a-b)-(c+d))&&B2==(a-(b-(c-d)))&&C2==(-a-(-b))&&D2==((a-b)-c),myEnabled=False;qClick[pn];qTryAgainNOT[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Correct\",\nFontColor->RGBColor[1, 0, 0]]\)", A2!=bigNumber&&B2!=bigNumber&&C2!=bigNumber&&D2!=bigNumber, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer Incorrect",True, text2<>"\n\nAnswer ?"]]; expers={"("<>ToString[a]<>" - "<>ToString[b]<>") - ("<>ToString[c]<>" + "<>ToString[d]<>")", "-"<>ToString[a]<>" - ( - "<>ToString[b]<>")","("<>ToString[a]<>" - "<>ToString[b]<>") - "<>ToString[c],ToString[a]<>"-("<>ToString[b]<>"-("<>ToString[c]<>"-"<>ToString[d]<>"))"}; answers = {InputField[Dynamic[A1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[C1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[D1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[B1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3]}; (* BEIGN: Problem independent Code *) (* Shuffle the answer keys *) (* index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; expersShuffled = Table[expers[[index[[i]]]], {i, 1,Length[answers]}]; *) answersShuffled = answers; expersShuffled = expers; body = { (* First row/colum the answer key *) {"A ","B ","C ","D "}, (* First row/colum the proposed answers key *) expersShuffled, (* First row/colum the answer check boxes*) answersShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left,Spacings->{4,0.5}(*,ItemSize->20)*)],answerStudent,ImageMargins->1],DefaultOptions->{InputField->{ContinuousAction->True},FontSize->Large}]], (* END: Problem independant code *) {{xxx,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];xxx=RandomReal[0.5];a=RandomInteger[{1,20}];b=RandomInteger[{1,20}];c=RandomInteger[{1,20}];d=RandomInteger[{1,20}];myEnabled=True;A2=bigNumber;B2=bigNumber;C2=bigNumber;D2=bigNumber;A1=Null;B1=Null; C1=Null; D1=Null;RunScheduledTask[myEnabled=True,{1}]], hintPanelExpr1[a,b,c,d]}], OpenerView[{Button["Hint",qTryAgain[pn];stateH=Not[stateH]],qPaneHintExpr1[a,b,c,d]},stateH], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanelExpr1[a,b,c,d]},state]},{Null,Null}}] &} , TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) (* better setup: Style[Manipulator[0.5, Appearance -> {"Open", Tiny}], DefaultOptions -> {Dynamic -> {BaseStyle -> Magnification -> 3}}] *) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[ Manipulate[ text2={ToString[pn]<>". "<>"Simplify each of the following"}; answer="?"; (* If for the Null testhing has to be inside the dynamic *) (* FIXME: RunScheduledTask is no longer necessary, check and remove or modify *) answerStudent= Dynamic[A2=If[TrueQ[A1==Null], bigNumber,A1];B2=If[TrueQ[B1==Null], bigNumber,B1];C2=If[TrueQ[C1==Null], bigNumber,C1];D2=If[TrueQ[D1==Null], bigNumber,D1]; Which [A2==((a-b)-(c+d))&&B2==(a-(b-(c-d)))&&C2==(-a-(-b))&&D2==((a-b)-c),myEnabled=False;qClick[pn];qTryAgainNOT[pn];text2<>"", A2!=bigNumber&&B2!=bigNumber&&C2!=bigNumber&&D2!=bigNumber, myEnabled=False;qClickPlus[pn];text2<>"",True, text2<>""]]; expers={"("<>ToString[a]<>" - "<>ToString[b]<>") - ("<>ToString[c]<>" + "<>ToString[d]<>")", "-"<>ToString[a]<>" - ( - "<>ToString[b]<>")","("<>ToString[a]<>" - "<>ToString[b]<>") - "<>ToString[c],ToString[a]<>"-("<>ToString[b]<>"-("<>ToString[c]<>"-"<>ToString[d]<>"))"}; answers = {InputField[Dynamic[A1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[C1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[D1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[B1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3]}; (* BEIGN: Problem independent Code *) (* Shuffle the answer keys *) (* FIXME: loops for a bit do not know why index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; expersShuffled = Table[expers[[index[[i]]]], {i, 1,Length[answers]}]; *) answersShuffled = answers; expersShuffled = expers; (* for some reaons the manipulate sometimes runs a few times before settling down, so we moved it to here so the shuffle is not seen in the panel *) body = { (* First row/colum the answer key *) {"A ","B ","C ","D "}, (* First row/colum the proposed answers key *) expersShuffled, (* First row/colum the answer check boxes*) answersShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left,Spacings->{4,0.5}(*,ItemSize->20)*)],answerStudent,ImageMargins->1],DefaultOptions->{InputField->{ContinuousAction->True},FontSize->Large}]], (* END: Problem independant code *) (*{a,1,""}*)"", (* initial value of a*) (*TrackedSymbols->Manipulate,*) SaveDefinitions->True(*,AutorunSequencing->{1,2}*),AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) (* better setup: Style[Manipulator[0.5, Appearance -> {"Open", Tiny}], DefaultOptions -> {Dynamic -> {BaseStyle -> Magnification -> 3}}] *) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] qPanelExpr1Rev[pn0_,a0_,b0_,c0_,d0_,hint0_]:= Module[{pn=pn0,text,hint=hint0,A2=bigNumber,B2=bigNumber,C2=bigNumber,D2=bigNumber,A1=Null,B1=Null, C1=Null, D1=Null,answer,a=a0,b=b0,c=c0,d=d0,myEnabled=True,text2,body, expers, answers,answersShuffled,expersShuffled,index,answerStudent,tryAgain=True, state=False, diag=diag0 }, Style[Manipulate[ text2={ToString[pn]<>". "<>"Simplify each of the following"}; answer="?"; (* If for the Null testhing has to be inside the dynamic *) (* FIXME: RunScheduledTask does not work correctly if the DynamicModule used *) answerStudent= Dynamic[A2=If[TrueQ[A1==Null], bigNumber,A1];B2=If[TrueQ[B1==Null], bigNumber,B1];C2=If[TrueQ[C1==Null], bigNumber,C1];D2=If[TrueQ[D1==Null], bigNumber,D1]; Which [A2==((a-b)-(c+d))&&B2==(a-(b-(c-d)))&&C2==(-a-(-b))&&D2==((a-b)-c),myEnabled=False;qClick[pn];qTryAgainNOT[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Correct\",\nFontColor->RGBColor[1, 0, 0]]\)", A2!=bigNumber&&B2!=bigNumber&&C2!=bigNumber&&D2!=bigNumber, RunScheduledTask[myEnabled=False,{1}];qClickPlus[pn];text2<>"\n\nAnswer Incorrect",True, text2<>"\n\nAnswer ?"]]; expers={"("<>ToString[a]<>" - "<>ToString[b]<>") - ("<>ToString[c]<>" + "<>ToString[d]<>")", "-"<>ToString[a]<>" - ( - "<>ToString[b]<>")","("<>ToString[a]<>" - "<>ToString[b]<>") - "<>ToString[c],"("<>ToString[a]<>"-("<>ToString[b]<>"-("<>ToString[c]<>"-"<>ToString[d]<>")))"}; answers = {InputField[Dynamic[A1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[C1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[D1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[B1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3]}; (* BEIGN: Problem independent Code *) (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; expersShuffled = Table[expers[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A ","B ","C ","D "}, (* First row/colum the proposed answers key *) expersShuffled, (* First row/colum the answer check boxes*) answersShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left,Spacings->{4,0.5}(*,ItemSize->20)*)],answerStudent,ImageMargins->1],DefaultOptions->{InputField->{ContinuousAction->True},FontSize->Large}]], (* END: Problem independant code *) {{a,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];a=RandomInteger[{1,20}];b=RandomInteger[{1,20}];c=RandomInteger[{1,20}];d=RandomInteger[{1,20}];myEnabled=True;A2=bigNumber;B2=bigNumber;C2=bigNumber;D2=bigNumber;A1=Null;B1=Null; C1=Null; D1=Null;RunScheduledTask[myEnabled=True,{1}]], hintPanelExpr1[a,b,c,d]}], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanelExpr1[a,b,c,d]},state]},{Null,Null}}] &} , TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) (* better setup: Style[Manipulator[0.5, Appearance -> {"Open", Tiny}], DefaultOptions -> {Dynamic -> {BaseStyle -> Magnification -> 3}}] *) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] qPanelExpr1Diag[pn0_,a0_,b0_,c0_,d0_,hint0_]:= DynamicModule[{pn=pn0,text,hint=hint0,A2=bigNumber,B2=bigNumber,C2=bigNumber,D2=bigNumber,A1=Null,B1=Null, C1=Null, D1=Null,answer,a=a0,b=b0,c=c0,d=d0,myEnabled=True,text2,body, expers, answers,answersShuffled,expersShuffled,index,answerStudent,tryAgain=True, state=False }, Style[Manipulate[ text2={ToString[pn]<>". "<>"Simplify each of the following"}; answer="?"; (* If for the Null testhing has to be inside the dynamic *) (* FIXME: RunScheduledTask does not work correctly if the DynamicModule used *) answerStudent= Dynamic[A2=If[TrueQ[A1==Null], bigNumber,A1];B2=If[TrueQ[B1==Null], bigNumber,B1];C2=If[TrueQ[C1==Null], bigNumber,C1];D2=If[TrueQ[D1==Null], bigNumber,D1]; Which [A2==((a-b)-(c+d))&&B2==(a-(b-(c-d)))&&C2==(-a-(-b))&&D2==((a-b)-c),myEnabled=False;qClick[pn];qTryAgainNOT[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Correct\",\nFontColor->RGBColor[1, 0, 0]]\)", A2!=bigNumber&&B2!=bigNumber&&C2!=bigNumber&&D2!=bigNumber, RunScheduledTask[myEnabled=False,{1}];qClickPlus[pn];text2<>"\n\nAnswer Incorrect",True, text2<>"\n\nAnswer ?"]]; expers={"("<>ToString[a]<>" - "<>ToString[b]<>") - ("<>ToString[c]<>" + "<>ToString[d]<>")", "-"<>ToString[a]<>" - ( - "<>ToString[b]<>")","("<>ToString[a]<>" - "<>ToString[b]<>") - "<>ToString[c],"("<>ToString[a]<>"-("<>ToString[b]<>"-("<>ToString[c]<>"-"<>ToString[d]<>")))"}; answers = {InputField[Dynamic[A1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[C1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[D1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[B1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3]}; (* BEIGN: Problem independent Code *) (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; expersShuffled = Table[expers[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A ","B ","C ","D "}, (* First row/colum the proposed answers key *) expersShuffled, (* First row/colum the answer check boxes*) answersShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left,Spacings->{4,0.5}(*,ItemSize->20)*)],answerStudent,ImageMargins->1],DefaultOptions->{InputField->{ContinuousAction->True},FontSize->Large}]], (* END: Problem independant code *) (*{a,1,""}*)"", (* initial value of a*) (*TrackedSymbols->Manipulate,*) SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) (* better setup: Style[Manipulator[0.5, Appearance -> {"Open", Tiny}], DefaultOptions -> {Dynamic -> {BaseStyle -> Magnification -> 3}}] *) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] longMult[a0_, b0_]:=Module[{a=a0, b=b0}, (* borrowed code from Rob Morris *) Grid[{{ToString[a]},{StringJoin@@PadRight[{"\[Times]"},Max[2,Subtract@@Length/@{IntegerDigits[a],IntegerDigits[b]}+2]," "]<>ToString[b]},Sequence@@Table[{StringJoin@@Join[If[i==Length[IntegerDigits[b]],"+ ",""],PadRight[{ToString[a Reverse[IntegerDigits[b]][[i]]]},i ,"0"]]},{i,Length[IntegerDigits[b]]}],{ToString[a b]}},Alignment->Right,BaseStyle->{16,FontFamily->"Times"},Dividers->{{False},Join[{False,False,True},Table[False,{Length@IntegerDigits[b]-1}],{True}]}] ] solutionPanelExpr2[a0_,b0_,c0_,d0_,e0_,f0_,h0_,i0_]:=Module[{a=a0,b=b0,c=c0,d=d0,e=e0,f=f0,h=h0,i=i0,body}, body={ {longMult[a,b],longMult[c,d]},{longMult[e,f], longMult[h,i] } }; Panel[Grid[Transpose[body],Spacings->{3,3}]] ] qPaneHint1[a0_,b0_,c0_,d0_,e0_,f0_,h0_,i0_]:=ToString[Column[{"Rules of multiplying positive and negative integers:","(+)(+) = +", "(+)(-) = -", "(-)(+) = -", "(-)(-) = +"}],TraditionalForm] qPanelExpr2[pn0_,a0_,b0_,c0_,d0_,e0_,f0_,h0_,i0_,hint0_,diag0_]:= DynamicModule[{pn=pn0,text,hint=hint0,A2=bigNumber,B2=bigNumber,C2=bigNumber,D2=bigNumber,A1=Null,B1=Null, C1=Null, D1=Null,answer,a=a0,b=b0,c=c0,d=d0,e=e0,f=f0,h=h0,i=i0,myEnabled=True,text2,body, expers, answers,answersShuffled,expersShuffled,index,answerStudent,tryAgain=True,state=False,diag=diag0,xxx,stateH=False }, qNum +=1; If[diag==False, Style[Manipulate[ xxx=xxx; text2={ToString[pn]<>". Multiply each of the following"}; answer="?"; answerStudent= Dynamic[A2=If[TrueQ[A1==Null], bigNumber,A1];B2=If[TrueQ[B1==Null], bigNumber,B1];C2=If[TrueQ[C1==Null], bigNumber,C1];D2=If[TrueQ[D1==Null], bigNumber,D1]; Which [A2==(a*b)&&B2==(c*d)&&C2==(e*f)&&D2==(h*i),myEnabled=False;qClick[pn];qTryAgainNOT[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Correct\",\nFontColor->RGBColor[1, 0, 0]]\)", A2!=bigNumber&&B2!=bigNumber&&C2!=bigNumber&&D2!=bigNumber, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer Incorrect",True, text2<>"\n\nAnswer ?"]]; expers={"("<>ToString[a]<>")\[Times]("<>ToString[b]<>")","("<>ToString[e]<>")\[Times]("<>ToString[f]<>")","("<>ToString[h]<>")\[Times]("<>ToString[i]<>")", "("<>ToString[c]<>")\[Times]("<>ToString[d]<>")"}; answers = {InputField[Dynamic[A1],Expression,Enabled->Dynamic[myEnabled],FieldSize->5],InputField[Dynamic[C1],Expression,Enabled->Dynamic[myEnabled],FieldSize->5],InputField[Dynamic[D1],Expression,Enabled->Dynamic[myEnabled],FieldSize->5],InputField[Dynamic[B1],Expression,Enabled->Dynamic[myEnabled],FieldSize->5]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; expersShuffled = Table[expers[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A ","B ","C ","D "}, (* First row/colum the proposed answers key *) expersShuffled, (* First row/colum the answer check boxes*) answersShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left,Spacings->{4,0.5}(*,ItemSize->20)*)],answerStudent,ImageMargins->60],DefaultOptions->{InputField->{ContinuousAction->True}}]], {{xxx,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];xxx=RandomReal[0.5];a=RandomInteger[{-20,20}];b=RandomInteger[{-20,20}];c=RandomInteger[{-20,20}];d=RandomInteger[{-20,20}];e=RandomInteger[{-20,20}];f=RandomInteger[{-20,20}];h=RandomInteger[{-20,20}];i=RandomInteger[{-20,20}];myEnabled=True;A2=bigNumber;B2=bigNumber;C2=bigNumber;D2=bigNumber;A1=Null;B1=Null; C1=Null; D1=Null;RunScheduledTask[myEnabled=True,{1}]], ""}], OpenerView[{Button["Hint",qTryAgain[pn];stateH=Not[stateH]],qPaneHint1[a,b,c,d,e,f,h,i]},stateH], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanelExpr2[a,b,c,d,e,f,h,i]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ a=RandomInteger[{-20,20}];b=RandomInteger[{-20,20}];c=RandomInteger[{-20,20}];d=RandomInteger[{-20,20}];e=RandomInteger[{-20,20}];f=RandomInteger[{-20,20}];h=RandomInteger[{-20,20}];i=RandomInteger[{-20,20}]; text2={ToString[pn]<>". Multiply each of the following"}; answer="?"; answerStudent= Dynamic[A2=If[TrueQ[A1==Null], bigNumber,A1];B2=If[TrueQ[B1==Null], bigNumber,B1];C2=If[TrueQ[C1==Null], bigNumber,C1];D2=If[TrueQ[D1==Null], bigNumber,D1]; Which [A2==(a*b)&&B2==(c*d)&&C2==(e*f)&&D2==(h*i),myEnabled=False;qClick[pn];qTryAgainNOT[pn];text2<>"", A2!=bigNumber&&B2!=bigNumber&&C2!=bigNumber&&D2!=bigNumber, myEnabled=False;qClickPlus[pn];text2<>"",True, text2<>""]]; expers={"("<>ToString[a]<>")\[Times]("<>ToString[b]<>")","("<>ToString[e]<>")\[Times]("<>ToString[f]<>")","("<>ToString[h]<>")\[Times]("<>ToString[i]<>")", "("<>ToString[c]<>")\[Times]("<>ToString[d]<>")"}; answers = {InputField[Dynamic[A1],Expression,Enabled->Dynamic[myEnabled],FieldSize->5],InputField[Dynamic[C1],Expression,Enabled->Dynamic[myEnabled],FieldSize->5],InputField[Dynamic[D1],Expression,Enabled->Dynamic[myEnabled],FieldSize->5],InputField[Dynamic[B1],Expression,Enabled->Dynamic[myEnabled],FieldSize->5]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[j]]]], {j, 1,Length[answers]}]; expersShuffled = Table[expers[[index[[j]]]], {j, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A ","B ","C ","D "}, (* First row/colum the proposed answers key *) expersShuffled, (* First row/colum the answer check boxes*) answersShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left,Spacings->{4,0.5}(*,ItemSize->20)*)],answerStudent,ImageMargins->60],DefaultOptions->{InputField->{ContinuousAction->True}}]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] qPanelExpr2Diag[pn0_,a0_,b0_,c0_,d0_,e0_,f0_,h0_,i0_,hint0_]:= Module[{pn=pn0,text,hint=hint0,A2=bigNumber,B2=bigNumber,C2=bigNumber,D2=bigNumber,A1=Null,B1=Null, C1=Null, D1=Null,answer,a=a0,b=b0,c=c0,d=d0,e=e0,f=f0,h=h0,i=i0,myEnabled=True,text2,body, expers, answers,answersShuffled,expersShuffled,index,answerStudent,tryAgain=True,state=False,diag=diag0 }, Style[Manipulate[ text2={ToString[pn]<>". Multiply each of the following"}; answer="?"; answerStudent= Dynamic[A2=If[TrueQ[A1==Null], bigNumber,A1];B2=If[TrueQ[B1==Null], bigNumber,B1];C2=If[TrueQ[C1==Null], bigNumber,C1];D2=If[TrueQ[D1==Null], bigNumber,D1]; Which [A2==(a*b)&&B2==(c*d)&&C2==(e*f)&&D2==(h*i),myEnabled=False;qClick[pn];qTryAgainNOT[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Correct\",\nFontColor->RGBColor[1, 0, 0]]\)", A2!=bigNumber&&B2!=bigNumber&&C2!=bigNumber&&D2!=bigNumber, RunScheduledTask[myEnabled=False,{1}];qClickPlus[pn];text2<>"\n\nAnswer Incorrect",True, text2<>"\n\nAnswer ?"]]; expers={"("<>ToString[a]<>")\[Times]("<>ToString[b]<>")","("<>ToString[e]<>")\[Times]("<>ToString[f]<>")","("<>ToString[h]<>")\[Times]("<>ToString[i]<>")", "("<>ToString[c]<>")\[Times]("<>ToString[d]<>")"}; answers = {InputField[Dynamic[A1],Expression,Enabled->Dynamic[myEnabled],FieldSize->5],InputField[Dynamic[C1],Expression,Enabled->Dynamic[myEnabled],FieldSize->5],InputField[Dynamic[D1],Expression,Enabled->Dynamic[myEnabled],FieldSize->5],InputField[Dynamic[B1],Expression,Enabled->Dynamic[myEnabled],FieldSize->5]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; expersShuffled = Table[expers[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A ","B ","C ","D "}, (* First row/colum the proposed answers key *) expersShuffled, (* First row/colum the answer check boxes*) answersShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left,Spacings->{4,0.5}(*,ItemSize->20)*)],answerStudent,ImageMargins->60],DefaultOptions->{InputField->{ContinuousAction->True}}]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] qPanelExpr2Rev[pn0_,a0_,b0_,c0_,d0_,e0_,f0_,h0_,i0_,hint0_]:= Module[{pn=pn0,text,hint=hint0,A2=bigNumber,B2=bigNumber,C2=bigNumber,D2=bigNumber,A1=Null,B1=Null, C1=Null, D1=Null,answer,a=a0,b=b0,c=c0,d=d0,e=e0,f=f0,h=h0,i=i0,myEnabled=True,text2,body, expers, answers,answersShuffled,expersShuffled,index,answerStudent,tryAgain=True,state=False,diag=diag0 }, Style[Manipulate[ text2={ToString[pn]<>". Multiply each of the following"}; answer="?"; answerStudent= Dynamic[A2=If[TrueQ[A1==Null], bigNumber,A1];B2=If[TrueQ[B1==Null], bigNumber,B1];C2=If[TrueQ[C1==Null], bigNumber,C1];D2=If[TrueQ[D1==Null], bigNumber,D1]; Which [A2==(a*b)&&B2==(c*d)&&C2==(e*f)&&D2==(h*i),myEnabled=False;qClick[pn];qTryAgainNOT[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Correct\",\nFontColor->RGBColor[1, 0, 0]]\)", A2!=bigNumber&&B2!=bigNumber&&C2!=bigNumber&&D2!=bigNumber, RunScheduledTask[myEnabled=False,{1}];qClickPlus[pn];text2<>"\n\nAnswer Incorrect",True, text2<>"\n\nAnswer ?"]]; expers={"("<>ToString[a]<>")\[Times]("<>ToString[b]<>")","("<>ToString[e]<>")\[Times]("<>ToString[f]<>")","("<>ToString[h]<>")\[Times]("<>ToString[i]<>")", "("<>ToString[c]<>")\[Times]("<>ToString[d]<>")"}; answers = {InputField[Dynamic[A1],Expression,Enabled->Dynamic[myEnabled],FieldSize->5],InputField[Dynamic[C1],Expression,Enabled->Dynamic[myEnabled],FieldSize->5],InputField[Dynamic[D1],Expression,Enabled->Dynamic[myEnabled],FieldSize->5],InputField[Dynamic[B1],Expression,Enabled->Dynamic[myEnabled],FieldSize->5]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; expersShuffled = Table[expers[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A ","B ","C ","D "}, (* First row/colum the proposed answers key *) expersShuffled, (* First row/colum the answer check boxes*) answersShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left,Spacings->{4,0.5}(*,ItemSize->20)*)],answerStudent,ImageMargins->60],DefaultOptions->{InputField->{ContinuousAction->True}}]], {{a,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];a=RandomInteger[{-20,20}];b=RandomInteger[{-20,20}];c=RandomInteger[{-20,20}];d=RandomInteger[{-20,20}];e=RandomInteger[{-20,20}];f=RandomInteger[{-20,20}];h=RandomInteger[{-20,20}];i=RandomInteger[{-20,20}];myEnabled=True;A2=bigNumber;B2=bigNumber;C2=bigNumber;D2=bigNumber;A1=Null;B1=Null; C1=Null; D1=Null;RunScheduledTask[myEnabled=True,{1}]], ""}], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanelExpr2[a,b,c,d,e,f,h,i]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] solutionPanelExprFrac1[a0_,b0_,c0_,d0_,e0_,f0_,h0_,i0_]:=Module[{a=a0,b=b0,c=c0,d=d0,e=e0,f=f0,h=h0,i=i0,body}, body={ {ToString[ToString[a]/ToString[b],StandardForm]<>"+"<>ToString[ToString[c]/ToString[d],StandardForm]<>" = "<>ToString[(ToString[a]<>"\[Times]"<>ToString[d])<>"+"<>(ToString[c]<>"\[Times]"<>ToString[b])/ToString[b]<>"\[Times]"<>ToString[d],StandardForm]<>" = "<>ToString[(a/b)+(c/d),StandardForm], ToString[ToString[i]/ToString[b],StandardForm]<>"+"<>ToString[ToString[h]/ToString[a],StandardForm]<>" = "<>ToString[(ToString[i]<>"\[Times]"<>ToString[a])<>"+"<>(ToString[h]<>"\[Times]"<>ToString[b])/ToString[b]<>"\[Times]"<>ToString[a],StandardForm]<>" = "<>ToString[(i/b)+(h/a),StandardForm], ToString[ToString[e]/ToString[f],StandardForm]<>"-"<>ToString[ToString[h]/ToString[i],StandardForm]<>" = "<>ToString[(ToString[e]<>"\[Times]"<>ToString[i])<>"-"<>(ToString[h]<>"\[Times]"<>ToString[f])/ToString[f]<>"\[Times]"<>ToString[i],StandardForm]<>" = "<>ToString[(e/f)-(h/i),StandardForm], ToString[ToString[d]/ToString[e],StandardForm]<>"-"<>ToString[ToString[c]/ToString[i],StandardForm]<>" = "<>ToString[(ToString[d]<>"\[Times]"<>ToString[i])<>"-"<>(ToString[c]<>"\[Times]"<>ToString[e])/ToString[e]<>"\[Times]"<>ToString[i],StandardForm]<>" = "<>ToString[(d/e)-(c/i),StandardForm] }, {Null,Null,Null,Null} }; Panel[Grid[Transpose[body],Spacings->{3,3}]] ] hintPanelExprFrac1[]:=Module[{body}, body={ {"To get a single value for the sum of money in different denominations, the different denominations must be converted a common denomination."},{Null} }; Panel[Grid[Transpose[body],Spacings->{3,3}]] ] qPanelExprFrac1[pn0_,a0_,b0_,c0_,d0_,e0_,f0_,h0_,i0_,diag0_]:= Module[{pn=pn0,text,hint=hint0,A2=bigNumber,B2=bigNumber,C2=bigNumber,D2=bigNumber,A1=Null,B1=Null, C1=Null, D1=Null,answer,a=a0,b=b0,c=c0,d=d0,e=e0,f=f0,h=h0,i=i0,myEnabled=True,text2,body, expers, answers,answersShuffled,expersShuffled,index,answerStudent,tryAgain=True,state=False,diag=diag0 }, answerA[]:= (a/b)+(c/d); answerB[]:=(e/f)-(h/i); answerC[]:= (d/e)-(c/i); answerD[]:= (i/b)+(h/a); Style[Manipulate[ text2={ToString[pn]<>". Simplify each of the following"}; answer="?"; answerStudent= Dynamic[A2=If[TrueQ[A1==Null]||Position[A1,_Plus]!={}||Position[A1,_Minus]!={}, bigNumber,ReleaseHold[A1]];B2=If[TrueQ[B1==Null]||Position[B1,_Plus]!={}||Position[B1,_Minus]!={}, bigNumber,ReleaseHold[B1]];C2=If[TrueQ[C1==Null]||Position[C1,_Plus]!={}||Position[C1,_Minus]!={}, bigNumber,ReleaseHold[C1]];D2=If[TrueQ[D1==Null]||Position[D1,_Plus]!={}||Position[D1,_Minus]!={}, bigNumber,ReleaseHold[D1]]; Which [A2==answerA[]&&B2==answerB[]&&C2==answerC[]&&D2==answerD[],myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Correct\",\nFontColor->RGBColor[1, 0, 0]]\)", A2!=bigNumber&&B2!=bigNumber&&C2!=bigNumber&&D2!=bigNumber, RunScheduledTask[myEnabled=False,{1}];text2<>"\n\nAnswer Incorrect",True, text2<>"\n\nAnswer ?"]]; (* Swap B & C *) expers={ToString[ToString[ToString[a]/ToString[b],StandardForm]<>"+"<>ToString[ToString[c]/ToString[d],StandardForm],StandardForm] ,ToString[ToString[ToString[d]/ToString[e],StandardForm]<>"-"<>ToString[ToString[c]/ToString[i],StandardForm],StandardForm],ToString[ToString[ToString[i]/ToString[b],StandardForm]<>"+"<>ToString[ToString[h]/ToString[a],StandardForm],StandardForm],ToString[ToString[ToString[e]/ToString[f],StandardForm]<>"-"<>ToString[ToString[h]/ToString[i],StandardForm],StandardForm]}; answers = {InputField[Dynamic[A1],Hold[Expression],Enabled->Dynamic[myEnabled],FieldSize->13],InputField[Dynamic[C1],Hold[Expression],Enabled->Dynamic[myEnabled],FieldSize->13],InputField[Dynamic[D1],Hold[Expression],Enabled->Dynamic[myEnabled],FieldSize->13],InputField[Dynamic[B1],Hold[Expression],Enabled->Dynamic[myEnabled],FieldSize->13]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; expersShuffled = Table[expers[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A ","B ","C ","D "}, (* First row/colum the proposed answers key *) expersShuffled, (* First row/colum the answer check boxes*) answersShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left,Spacings->{4,0.5}(*,ItemSize->20)*)],answerStudent,ImageMargins->60],DefaultOptions->{InputField->{ContinuousAction->True}}]], {{a,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];a=RandomInteger[{1,5}];b=a+RandomInteger[{1,5}];c=b+RandomInteger[{1,5}];d=c+RandomInteger[{1,5}];e=d+RandomInteger[{1,5}];f=e+RandomInteger[{1,5}];h=f+RandomInteger[{1,5}];i=h+RandomInteger[{1,5}];myEnabled=True;A2=bigNumber;B2=bigNumber;C2=bigNumber;D2=bigNumber;A1=Null;B1=Null; C1=Null; D1=Null;RunScheduledTask[myEnabled=True,{1}],Enabled->diag], hintPanelExprFrac1[]},Enabled->diag], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state],Enabled->diag],solutionPanelExprFrac1[a,b,c,d,e,f,h,i]},state,Enabled->diag]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] solutionPanelExpr3[a0_,b0_,c0_,d0_,e0_,f0_,g0_]:=Module[{a=a0,b=b0,c=c0,d=d0,e=e0,f=f0,g=g0,body}, body={ {"("<>qSign[a]<>")-("<>qSign[b]<> ")+("<>qSign[c]<>")+("<>qSign[d]<>")-("<>qSign[e]<>")"<>"\n", "= "<>"("<>qSign[a-b]<>")+("<>qSign[c]<>")+("<>qSign[d]<>")-("<>qSign[e]<>")"<>"\n", "= "<>"("<>qSign[a-b+c]<>")+("<>qSign[d]<>")-("<>qSign[e]<>")"<>"\n", "= "<>"("<>qSign[a-b+c+d]<>")-("<>qSign[e]<>")"<>"\n", "= "<>qSign[a-b+c+d-e]<>"\n\n", ToString[-3*a*g]<>"\[Divide]("<>qSign[a]<>")-("<>ToString[b]<>"+"<>ToString[c]<>")"<>"\n", "= "<>"("<>qSign[-3*g]<>")-("<>ToString[b]<>"+"<>ToString[c]<>")"<>"\n", "= "<>"("<>qSign[-3*g]<>")-("<>qSign[b+c]<>")"<>"\n", "= "<>qSign[-3*g-(b+c)]<>"\n\n", "("<>ToString[a]<>"-"<>ToString[b]<>") - ("<>ToString[f]<>"-"<>ToString[g]<>")"<>"\n", "= "<>"("<>qSign[a-b]<>") - ("<>ToString[f]<>"-"<>ToString[g]<>")"<>"\n", "= "<>"("<>qSign[a-b]<>") - ("<>qSign[f-g]<>")"<>"\n", "= "<>qSign[(a-b)-(f-g)]<>"\n\n", ToString[a]<>"-(("<>ToString[b]<>")\[Times]("<>ToString[c]<>") +"<>ToString[ToString[d]^2,StandardForm]<>")"<>"\n", "= "<>ToString[a]<>"-(("<>qSign[b*c]<>") +"<>ToString[ToString[d]^2,StandardForm]<>")"<>"\n", "= "<>ToString[a]<>"-(("<>qSign[b*c]<>") +"<>ToString[d^2]<>")"<>"\n", "= "<>ToString[a]<>"-("<>qSign[(b*c)+d^2]<>")"<>"\n", "= "<>ToString[a-((b*c)+d^2)]<>"\n" },{Null, Null, Null,Null, Null, Null, Null,Null, Null, Null, Null,Null, Null, Null, Null, Null,Null, Null}}; Panel[Grid[Transpose[body]]] ] qPanelExpr3[pn0_,a0_,b0_,c0_,d0_,e0_,f0_,g0_,diag0_]:= DynamicModule[{pn=pn0,text,hint=hint0,A2=bigNumber,B2=bigNumber,C2=bigNumber,D2=bigNumber,A1=Null,B1=Null, C1=Null, D1=Null,answer,a=a0,b=b0,c=c0,d=d0,e=e0,f=f0,g=g0,myEnabled=True,text2,body, expers, answers,answersShuffled,expersShuffled,index,answerStudent,tryAgain=True, state=False,diag=diag0,xxx }, If[diag==False, Style[ Manipulate[ xxx=xxx; text2={ToString[pn]<>". "<>"Simplify each of the following"}; answer="?"; (* make sure a is not 0 *) answerStudent= Dynamic[A2=If[TrueQ[A1==Null], bigNumber,A1];B2=If[TrueQ[B1==Null], bigNumber,B1];C2=If[TrueQ[C1==Null], bigNumber,C1];D2=If[TrueQ[D1==Null], bigNumber,D1]; Which [A2==(a-b+c+d-e)&&B2==(a-((b*c)+d^2))&&C2==((-3*a*g/a)-(b+c))&&D2==((a-b)-(f-g)),myEnabled=False;qClick[pn];qTryAgainNOT[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Correct\",\nFontColor->RGBColor[1, 0, 0]]\)", A2!=bigNumber&&B2!=bigNumber&&C2!=bigNumber&&D2!=bigNumber, RunScheduledTask[myEnabled=False,{1}];qClickPlus[pn];text2<>"\n\nAnswer Incorrect",True, text2<>"\n\nAnswer ?"]]; expers={"("<>qSign[a]<>")-("<>qSign[b]<> ")+("<>qSign[c]<>")+("<>qSign[d]<>")-("<>qSign[e]<>")",ToString[-3*a*g]<>"\[Divide]("<>qSign[a]<>")-("<>ToString[b]<>"+"<>ToString[c]<>")","("<>ToString[a]<>"-"<>ToString[b]<>") - ("<>ToString[f]<>"-"<>ToString[g]<>")",ToString[a]<>"-(("<>ToString[b]<>")\[Times]("<>ToString[c]<>") +"<>ToString[ToString[d]^2,StandardForm]<>")"}; answers = {InputField[Dynamic[A1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[C1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[D1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[B1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3]}; (* BEIGN: Problem independent Code *) (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; expersShuffled = Table[expers[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A ","B ","C ","D "}, (* First row/colum the proposed answers key *) expersShuffled, (* First row/colum the answer check boxes*) answersShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left,Spacings->{4,0.5},ItemSize->{{2,20}}],answerStudent,ImageMargins->40],DefaultOptions->{InputField->{ContinuousAction->True},FontSize->Large}]], (* END: Problem independant code *) {{xxx,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];xxx=RandomReal[0.5];a=RandomInteger[{1,20}];b=RandomInteger[{1,20}];c=RandomInteger[{1,20}];d=RandomInteger[{1,10}];e=RandomInteger[{1,10}];f=RandomInteger[{1,10}];g=RandomInteger[{1,10}];myEnabled=True;A2=bigNumber;B2=bigNumber;C2=bigNumber;D2=bigNumber;A1=Null;B1=Null; C1=Null; D1=Null;RunScheduledTask[myEnabled=True,{1}]], ""}], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanelExpr3[a,b,c,d,e,f,g]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) (* better setup: Style[Manipulator[0.5, Appearance -> {"Open", Tiny}], DefaultOptions -> {Dynamic -> {BaseStyle -> Magnification -> 3}}] *) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[ Manipulate[ text2={ToString[pn]<>". "<>"Simplify each of the following"}; answer="?"; (* make sure a is not 0 *) answerStudent= Dynamic[A2=If[TrueQ[A1==Null], bigNumber,A1];B2=If[TrueQ[B1==Null], bigNumber,B1];C2=If[TrueQ[C1==Null], bigNumber,C1];D2=If[TrueQ[D1==Null], bigNumber,D1]; Which [A2==(a-b+c+d-e)&&B2==(a-((b*c)+d^2))&&C2==((-3*a*g/a)-(b+c))&&D2==((a-b)-(f-g)),myEnabled=False;qClick[pn];qTryAgainNOT[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Correct\",\nFontColor->RGBColor[1, 0, 0]]\)", A2!=bigNumber&&B2!=bigNumber&&C2!=bigNumber&&D2!=bigNumber, RunScheduledTask[myEnabled=False,{1}];qClickPlus[pn];text2<>"\n\nAnswer Incorrect",True, text2<>"\n\nAnswer ?"]]; expers={"("<>qSign[a]<>")-("<>qSign[b]<> ")+("<>qSign[c]<>")+("<>qSign[d]<>")-("<>qSign[e]<>")",ToString[-3*a*g]<>"\[Divide]("<>qSign[a]<>")-("<>ToString[b]<>"+"<>ToString[c]<>")","("<>ToString[a]<>"-"<>ToString[b]<>") - ("<>ToString[f]<>"-"<>ToString[g]<>")",ToString[a]<>"-(("<>ToString[b]<>")\[Times]("<>ToString[c]<>") +"<>ToString[ToString[d]^2,StandardForm]<>")"}; answers = {InputField[Dynamic[A1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[C1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[D1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[B1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3]}; (* BEIGN: Problem independent Code *) (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; expersShuffled = Table[expers[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A ","B ","C ","D "}, (* First row/colum the proposed answers key *) expersShuffled, (* First row/colum the answer check boxes*) answersShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left,Spacings->{4,0.5},ItemSize->{{2,20}}],answerStudent,ImageMargins->40],DefaultOptions->{InputField->{ContinuousAction->True},FontSize->Large}]], (* END: Problem independant code *) "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) (* better setup: Style[Manipulator[0.5, Appearance -> {"Open", Tiny}], DefaultOptions -> {Dynamic -> {BaseStyle -> Magnification -> 3}}] *) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] qPanelExpr3Diag[pn0_,a0_,b0_,c0_,d0_,e0_,f0_,g0_]:= Module[{pn=pn0,text,hint=hint0,A2=bigNumber,B2=bigNumber,C2=bigNumber,D2=bigNumber,A1=Null,B1=Null, C1=Null, D1=Null,answer,a=a0,b=b0,c=c0,d=d0,e=e0,f=f0,g=g0,myEnabled=True,text2,body, expers, answers,answersShuffled,expersShuffled,index,answerStudent,tryAgain=True, state=False,diag=diag0 }, Style[ Manipulate[ text2={ToString[pn]<>". "<>"Simplify each of the following"}; answer="?"; (* make sure a is not 0 *) answerStudent= Dynamic[A2=If[TrueQ[A1==Null], bigNumber,A1];B2=If[TrueQ[B1==Null], bigNumber,B1];C2=If[TrueQ[C1==Null], bigNumber,C1];D2=If[TrueQ[D1==Null], bigNumber,D1]; Which [A2==(a-b+c+d-e)&&B2==(a-((b*c)+d^2))&&C2==((-3*a*g/a)-(b+c))&&D2==((a-b)-(f-g)),myEnabled=False;qClick[pn];qTryAgainNOT[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Correct\",\nFontColor->RGBColor[1, 0, 0]]\)", A2!=bigNumber&&B2!=bigNumber&&C2!=bigNumber&&D2!=bigNumber, RunScheduledTask[myEnabled=False,{1}];qClickPlus[pn];text2<>"\n\nAnswer Incorrect",True, text2<>"\n\nAnswer ?"]]; expers={"("<>qSign[a]<>")-("<>qSign[b]<> ")+("<>qSign[c]<>")+("<>qSign[d]<>")-("<>qSign[e]<>")",ToString[-3*a*g]<>"\[Divide]("<>qSign[a]<>")-("<>ToString[b]<>"+"<>ToString[c]<>")","("<>ToString[a]<>"-"<>ToString[b]<>") - ("<>ToString[f]<>"-"<>ToString[g]<>")",ToString[a]<>"-(("<>ToString[b]<>")\[Times]("<>ToString[c]<>") +"<>ToString[ToString[d]^2,StandardForm]<>")"}; answers = {InputField[Dynamic[A1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[C1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[D1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[B1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3]}; (* BEIGN: Problem independent Code *) (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; expersShuffled = Table[expers[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A ","B ","C ","D "}, (* First row/colum the proposed answers key *) expersShuffled, (* First row/colum the answer check boxes*) answersShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left,Spacings->{4,0.5},ItemSize->{{2,20}}],answerStudent,ImageMargins->40],DefaultOptions->{InputField->{ContinuousAction->True},FontSize->Large}]], (* END: Problem independant code *) "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) (* better setup: Style[Manipulator[0.5, Appearance -> {"Open", Tiny}], DefaultOptions -> {Dynamic -> {BaseStyle -> Magnification -> 3}}] *) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] qPanelExpr3Rev[pn0_,a0_,b0_,c0_,d0_,e0_,f0_,g0_]:= Module[{pn=pn0,text,hint=hint0,A2=bigNumber,B2=bigNumber,C2=bigNumber,D2=bigNumber,A1=Null,B1=Null, C1=Null, D1=Null,answer,a=a0,b=b0,c=c0,d=d0,e=e0,f=f0,g=g0,myEnabled=True,text2,body, expers, answers,answersShuffled,expersShuffled,index,answerStudent,tryAgain=True, state=False,diag=diag0 }, Style[ Manipulate[ text2={ToString[pn]<>". "<>"Simplify each of the following"}; answer="?"; (* make sure a is not 0 *) answerStudent= Dynamic[A2=If[TrueQ[A1==Null], bigNumber,A1];B2=If[TrueQ[B1==Null], bigNumber,B1];C2=If[TrueQ[C1==Null], bigNumber,C1];D2=If[TrueQ[D1==Null], bigNumber,D1]; Which [A2==(a-b+c+d-e)&&B2==(a-((b*c)+d^2))&&C2==((-3*a*g/a)-(b+c))&&D2==((a-b)-(f-g)),myEnabled=False;qClick[pn];qTryAgainNOT[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Correct\",\nFontColor->RGBColor[1, 0, 0]]\)", A2!=bigNumber&&B2!=bigNumber&&C2!=bigNumber&&D2!=bigNumber, RunScheduledTask[myEnabled=False,{1}];qClickPlus[pn];text2<>"\n\nAnswer Incorrect",True, text2<>"\n\nAnswer ?"]]; expers={"("<>qSign[a]<>")-("<>qSign[b]<> ")+("<>qSign[c]<>")+("<>qSign[d]<>")-("<>qSign[e]<>")",ToString[-3*a*g]<>"\[Divide]("<>qSign[a]<>")-("<>ToString[b]<>"+"<>ToString[c]<>")","("<>ToString[a]<>"-"<>ToString[b]<>") - ("<>ToString[f]<>"-"<>ToString[g]<>")",ToString[a]<>"-(("<>ToString[b]<>")\[Times]("<>ToString[c]<>") +"<>ToString[ToString[d]^2,StandardForm]<>")"}; answers = {InputField[Dynamic[A1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[C1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[D1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[B1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3]}; (* BEIGN: Problem independent Code *) (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; expersShuffled = Table[expers[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A ","B ","C ","D "}, (* First row/colum the proposed answers key *) expersShuffled, (* First row/colum the answer check boxes*) answersShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left,Spacings->{4,0.5},ItemSize->{{2,20}}],answerStudent,ImageMargins->40],DefaultOptions->{InputField->{ContinuousAction->True},FontSize->Large}]], (* END: Problem independant code *) {{a,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];a=RandomInteger[{1,20}];b=RandomInteger[{1,20}];c=RandomInteger[{1,20}];d=RandomInteger[{1,10}];e=RandomInteger[{1,10}];f=RandomInteger[{1,10}];g=RandomInteger[{1,10}];myEnabled=True;A2=bigNumber;B2=bigNumber;C2=bigNumber;D2=bigNumber;A1=Null;B1=Null; C1=Null; D1=Null;RunScheduledTask[myEnabled=True,{1}]], ""}], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanelExpr3[a,b,c,d,e,f,g]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) (* better setup: Style[Manipulator[0.5, Appearance -> {"Open", Tiny}], DefaultOptions -> {Dynamic -> {BaseStyle -> Magnification -> 3}}] *) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] solutionPanelExpr4[a0_,b0_,c0_,d0_]:=Module[{a=a0,b=b0,c=c0,d=d0,body}, body={ {Text[ToString["("<>ToString[-1]<>")"^a,StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^b,StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^c,StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^d,StandardForm]<>"\n"], Text["="<>ToString["("<>ToString[(-1)^a]<>")",StandardForm]<>"+"<>ToString["("<>ToString[(-1)^b]<>")",StandardForm]<>"+"<>ToString["("<>ToString[(-1)^c]<>")",StandardForm]<>"+"<>ToString["("<>ToString[(-1)^d]<>")",StandardForm]<>"\n"], Text["="<>ToString[((-1)^a+(-1)^b+(-1)^c+(-1)^d)]<>"\n\n"], Text[ToString["("<>ToString[-1]<>")"^a,StandardForm]<>"-"<>ToString["("<>ToString[-1]<>")"^b,StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^c,StandardForm]<>"-"<>ToString["("<>ToString[-1]<>")"^d,StandardForm]<>"\n"], Text["="<>ToString["("<>ToString[(-1)^a]<>")",StandardForm]<>"-"<>ToString["("<>ToString[(-1)^b]<>")",StandardForm]<>"+"<>ToString["("<>ToString[(-1)^c]<>")",StandardForm]<>"-"<>ToString["("<>ToString[(-1)^d]<>")",StandardForm]<>"\n"], Text["="<>ToString[((-1)^a-(-1)^b+(-1)^c-(-1)^d)]<>"\n\n"], Text[ToString["("<>ToString[-1]<>")"^(2*a),StandardForm]<>"-"<>ToString["("<>ToString[-1]<>")"^(b+1),StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^c,StandardForm]<>"-"<>ToString["("<>ToString[-1]<>")"^(2*d),StandardForm]<>"\n"], Text["="<>ToString["("<>ToString[(-1)^(2*a)]<>")",StandardForm]<>"-"<>ToString["("<>ToString[(-1)^(b+1)]<>")",StandardForm]<>"+"<>ToString["("<>ToString[(-1)^c]<>")",StandardForm]<>"-"<>ToString["("<>ToString[(-1)^(2*d)]<>")",StandardForm]<>"\n"], Text["="<>ToString[(((-1)^(2*a))-((-1)^(b+1))+((-1)^c)-((-1)^(2*d)))]<>"\n\n"], Text[ToString["("<>ToString[-1]<>")"^(2*a),StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^(b+1),StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^c,StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^(2*d),StandardForm]<>"\n"], Text["="<>ToString["("<>ToString[(-1)^(2*a)]<>")",StandardForm]<>"+"<>ToString["("<>ToString[(-1)^(b+1)]<>")",StandardForm]<>"+"<>ToString["("<>ToString[(-1)^c]<>")",StandardForm]<>"+"<>ToString["("<>ToString[(-1)^(2*d)]<>")",StandardForm]<>"\n"], Text["="<>ToString[(((-1)^(2*a))+((-1)^(b+1))+((-1)^c)+((-1)^(2*d)))]<>"\n\n"] },{Null, Null, Null,Null, Null, Null,Null, Null, Null,Null, Null, Null}}; Panel[Grid[Transpose[body]]] ] hintPanelExpr4[]:=Module[{body}, body={ {Text["-1 to the odd power is -1"<>"\n"], Text["-1 to the even power is +1"<>"\n"]}, {Null, Null}}; Panel[Grid[Transpose[body]]] ] qPaneHintExpr4[a_,b_,c_,d_]:=ToString[Column[{"Note the even odd power (-1)","(-1\!\(\*SuperscriptBox[\()\), \(evens #\)]\) = 1","(-1\!\(\*SuperscriptBox[\()\), \(odd #\)]\) = -1"}],TraditionalForm] qPanelExpr4[pn0_,a0_,b0_,c0_,d0_,hint0_,diag0_]:= DynamicModule[{pn=pn0,text,hint=hint0,A2=bigNumber,B2=bigNumber,C2=bigNumber,D2=bigNumber,A1=Null,B1=Null, C1=Null, D1=Null,answer,a=a0,b=b0,c=c0,d=d0,myEnabled=True,text2,body, expers, answers,answersShuffled,expersShuffled,index,answerStudent,tryAgain=True, state=False, diag=diag0,xxx,stateH=False }, qNum += 1; If[diag==False, Style[ Manipulate[ xxx=xxx; text2={ToString[pn]<>". "<>"Simplify each of the following"}; answer="?"; (* make sure a is not 0 *) answerStudent= Dynamic[A2=If[TrueQ[A1==Null], bigNumber,A1];B2=If[TrueQ[B1==Null], bigNumber,B1];C2=If[TrueQ[C1==Null], bigNumber,C1];D2=If[TrueQ[D1==Null], bigNumber,D1]; Which [A2==((-1)^a+(-1)^b+(-1)^c+(-1)^d)&&B2==(((-1)^(2*a))+((-1)^(b+1))+((-1)^c)+((-1)^(2*d)))&&C2==((-1)^a-(-1)^b+(-1)^c-(-1)^d)&&D2==(((-1)^(2*a))-((-1)^(b+1))+((-1)^c)-((-1)^(2*d))),myEnabled=False;qClick[pn];qTryAgainNOT[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Correct\",\nFontColor->RGBColor[1, 0, 0]]\)", A2!=bigNumber&&B2!=bigNumber&&C2!=bigNumber&&D2!=bigNumber, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer Incorrect",True, text2<>"\n\nAnswer ?"]]; expers={ToString["("<>ToString[-1]<>")"^a,StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^b,StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^c,StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^d,StandardForm], ToString["("<>ToString[-1]<>")"^a,StandardForm]<>"-"<>ToString["("<>ToString[-1]<>")"^b,StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^c,StandardForm]<>"-"<>ToString["("<>ToString[-1]<>")"^d,StandardForm], ToString["("<>ToString[-1]<>")"^(2*a),StandardForm]<>"-"<>ToString["("<>ToString[-1]<>")"^(b+1),StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^c,StandardForm]<>"-"<>ToString["("<>ToString[-1]<>")"^(2*d),StandardForm], ToString["("<>ToString[-1]<>")"^(2*a),StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^(b+1),StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^c,StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^(2*d),StandardForm]}; answers = {InputField[Dynamic[A1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[C1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[D1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[B1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3]}; (* BEIGN: Problem independent Code *) (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; expersShuffled = Table[expers[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A ","B ","C ","D "}, (* First row/colum the proposed answers key *) expersShuffled, (* First row/colum the answer check boxes*) answersShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left,Spacings->{0.5,0.5},ItemSize->{{2,20}}],answerStudent,ImageMargins->40],DefaultOptions->{InputField->{ContinuousAction->True},FontSize->Large}]], (* END: Problem independant code *) {{xxx,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];xxx=RandomReal[0.5];a=RandomInteger[{1,20}];b=RandomInteger[{1,20}];c=RandomInteger[{1,20}];d=RandomInteger[{1,20}];myEnabled=True;A2=bigNumber;B2=bigNumber;C2=bigNumber;D2=bigNumber;A1=Null;B1=Null; C1=Null; D1=Null;RunScheduledTask[myEnabled=True,{1}]], hintPanelExpr4[]}], OpenerView[{Button["Hint",qTryAgain[pn];stateH=Not[stateH]],qPaneHintExpr4[a,b,c,d]},stateH], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanelExpr4[a,b,c,d]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) (* better setup: Style[Manipulator[0.5, Appearance -> {"Open", Tiny}], DefaultOptions -> {Dynamic -> {BaseStyle -> Magnification -> 3}}] *) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[ Manipulate[ a=RandomInteger[{1,20}];b=RandomInteger[{1,20}];c=RandomInteger[{1,20}];d=RandomInteger[{1,20}]; text2={ToString[pn]<>". "<>"Simplify each of the following"}; answer="?"; (* make sure a is not 0 *) answerStudent= Dynamic[A2=If[TrueQ[A1==Null], bigNumber,A1];B2=If[TrueQ[B1==Null], bigNumber,B1];C2=If[TrueQ[C1==Null], bigNumber,C1];D2=If[TrueQ[D1==Null], bigNumber,D1]; Which [A2==((-1)^a+(-1)^b+(-1)^c+(-1)^d)&&B2==(((-1)^(2*a))+((-1)^(b+1))+((-1)^c)+((-1)^(2*d)))&&C2==((-1)^a-(-1)^b+(-1)^c-(-1)^d)&&D2==(((-1)^(2*a))-((-1)^(b+1))+((-1)^c)-((-1)^(2*d))),myEnabled=False;qClick[pn];qTryAgainNOT[pn];text2<>"", A2!=bigNumber&&B2!=bigNumber&&C2!=bigNumber&&D2!=bigNumber, myEnabled=False;qClickPlus[pn];text2<>"",True, text2<>""]]; expers={ToString["("<>ToString[-1]<>")"^a,StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^b,StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^c,StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^d,StandardForm], ToString["("<>ToString[-1]<>")"^a,StandardForm]<>"-"<>ToString["("<>ToString[-1]<>")"^b,StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^c,StandardForm]<>"-"<>ToString["("<>ToString[-1]<>")"^d,StandardForm], ToString["("<>ToString[-1]<>")"^(2*a),StandardForm]<>"-"<>ToString["("<>ToString[-1]<>")"^(b+1),StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^c,StandardForm]<>"-"<>ToString["("<>ToString[-1]<>")"^(2*d),StandardForm], ToString["("<>ToString[-1]<>")"^(2*a),StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^(b+1),StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^c,StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^(2*d),StandardForm]}; answers = {InputField[Dynamic[A1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[C1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[D1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[B1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3]}; (* BEIGN: Problem independent Code *) (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; expersShuffled = Table[expers[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A ","B ","C ","D "}, (* First row/colum the proposed answers key *) expersShuffled, (* First row/colum the answer check boxes*) answersShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left,Spacings->{0.5,0.5},ItemSize->{{2,20}}],answerStudent,ImageMargins->40],DefaultOptions->{InputField->{ContinuousAction->True},FontSize->Large}]], (* END: Problem independant code *) "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) (* better setup: Style[Manipulator[0.5, Appearance -> {"Open", Tiny}], DefaultOptions -> {Dynamic -> {BaseStyle -> Magnification -> 3}}] *) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] qPanelExpr4Diag[pn0_,a0_,b0_,c0_,d0_,hint0_]:= Module[{pn=pn0,text,hint=hint0,A2=bigNumber,B2=bigNumber,C2=bigNumber,D2=bigNumber,A1=Null,B1=Null, C1=Null, D1=Null,answer,a=a0,b=b0,c=c0,d=d0,myEnabled=True,text2,body, expers, answers,answersShuffled,expersShuffled,index,answerStudent,tryAgain=True, state=False, diag=diag0 }, Style[ Manipulate[ text2={ToString[pn]<>". "<>"Simplify each of the following"}; answer="?"; (* make sure a is not 0 *) answerStudent= Dynamic[A2=If[TrueQ[A1==Null], bigNumber,A1];B2=If[TrueQ[B1==Null], bigNumber,B1];C2=If[TrueQ[C1==Null], bigNumber,C1];D2=If[TrueQ[D1==Null], bigNumber,D1]; Which [A2==((-1)^a+(-1)^b+(-1)^c+(-1)^d)&&B2==(((-1)^(2*a))+((-1)^(b+1))+((-1)^c)+((-1)^(2*d)))&&C2==((-1)^a-(-1)^b+(-1)^c-(-1)^d)&&D2==(((-1)^(2*a))-((-1)^(b+1))+((-1)^c)-((-1)^(2*d))),myEnabled=False;qClick[pn];qTryAgainNOT[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Correct\",\nFontColor->RGBColor[1, 0, 0]]\)", A2!=bigNumber&&B2!=bigNumber&&C2!=bigNumber&&D2!=bigNumber, RunScheduledTask[myEnabled=False,{1}];qClickPlus[pn];text2<>"\n\nAnswer Incorrect",True, text2<>"\n\nAnswer ?"]]; expers={ToString["("<>ToString[-1]<>")"^a,StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^b,StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^c,StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^d,StandardForm], ToString["("<>ToString[-1]<>")"^a,StandardForm]<>"-"<>ToString["("<>ToString[-1]<>")"^b,StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^c,StandardForm]<>"-"<>ToString["("<>ToString[-1]<>")"^d,StandardForm], ToString["("<>ToString[-1]<>")"^(2*a),StandardForm]<>"-"<>ToString["("<>ToString[-1]<>")"^(b+1),StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^c,StandardForm]<>"-"<>ToString["("<>ToString[-1]<>")"^(2*d),StandardForm], ToString["("<>ToString[-1]<>")"^(2*a),StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^(b+1),StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^c,StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^(2*d),StandardForm]}; answers = {InputField[Dynamic[A1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[C1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[D1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[B1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3]}; (* BEIGN: Problem independent Code *) (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; expersShuffled = Table[expers[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A ","B ","C ","D "}, (* First row/colum the proposed answers key *) expersShuffled, (* First row/colum the answer check boxes*) answersShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left,Spacings->{0.5,0.5},ItemSize->{{2,20}}],answerStudent,ImageMargins->40],DefaultOptions->{InputField->{ContinuousAction->True},FontSize->Large}]], (* END: Problem independant code *) "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) (* better setup: Style[Manipulator[0.5, Appearance -> {"Open", Tiny}], DefaultOptions -> {Dynamic -> {BaseStyle -> Magnification -> 3}}] *) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] qPanelExpr4Rev[pn0_,a0_,b0_,c0_,d0_,hint0_]:= Module[{pn=pn0,text,hint=hint0,A2=bigNumber,B2=bigNumber,C2=bigNumber,D2=bigNumber,A1=Null,B1=Null, C1=Null, D1=Null,answer,a=a0,b=b0,c=c0,d=d0,myEnabled=True,text2,body, expers, answers,answersShuffled,expersShuffled,index,answerStudent,tryAgain=True, state=False, diag=diag0 }, Style[ Manipulate[ text2={ToString[pn]<>". "<>"Simplify each of the following"}; answer="?"; (* make sure a is not 0 *) answerStudent= Dynamic[A2=If[TrueQ[A1==Null], bigNumber,A1];B2=If[TrueQ[B1==Null], bigNumber,B1];C2=If[TrueQ[C1==Null], bigNumber,C1];D2=If[TrueQ[D1==Null], bigNumber,D1]; Which [A2==((-1)^a+(-1)^b+(-1)^c+(-1)^d)&&B2==(((-1)^(2*a))+((-1)^(b+1))+((-1)^c)+((-1)^(2*d)))&&C2==((-1)^a-(-1)^b+(-1)^c-(-1)^d)&&D2==(((-1)^(2*a))-((-1)^(b+1))+((-1)^c)-((-1)^(2*d))),myEnabled=False;qClick[pn];qTryAgainNOT[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Correct\",\nFontColor->RGBColor[1, 0, 0]]\)", A2!=bigNumber&&B2!=bigNumber&&C2!=bigNumber&&D2!=bigNumber, RunScheduledTask[myEnabled=False,{1}];qClickPlus[pn];text2<>"\n\nAnswer Incorrect",True, text2<>"\n\nAnswer ?"]]; expers={ToString["("<>ToString[-1]<>")"^a,StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^b,StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^c,StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^d,StandardForm], ToString["("<>ToString[-1]<>")"^a,StandardForm]<>"-"<>ToString["("<>ToString[-1]<>")"^b,StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^c,StandardForm]<>"-"<>ToString["("<>ToString[-1]<>")"^d,StandardForm], ToString["("<>ToString[-1]<>")"^(2*a),StandardForm]<>"-"<>ToString["("<>ToString[-1]<>")"^(b+1),StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^c,StandardForm]<>"-"<>ToString["("<>ToString[-1]<>")"^(2*d),StandardForm], ToString["("<>ToString[-1]<>")"^(2*a),StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^(b+1),StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^c,StandardForm]<>"+"<>ToString["("<>ToString[-1]<>")"^(2*d),StandardForm]}; answers = {InputField[Dynamic[A1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[C1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[D1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3],InputField[Dynamic[B1],Expression,Enabled->Dynamic[myEnabled],FieldSize->3]}; (* BEIGN: Problem independent Code *) (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; expersShuffled = Table[expers[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A ","B ","C ","D "}, (* First row/colum the proposed answers key *) expersShuffled, (* First row/colum the answer check boxes*) answersShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left,Spacings->{0.5,0.5},ItemSize->{{2,20}}],answerStudent,ImageMargins->40],DefaultOptions->{InputField->{ContinuousAction->True},FontSize->Large}]], (* END: Problem independant code *) {{a,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];a=RandomInteger[{1,20}];b=RandomInteger[{1,20}];c=RandomInteger[{1,20}];d=RandomInteger[{1,20}];myEnabled=True;A2=bigNumber;B2=bigNumber;C2=bigNumber;D2=bigNumber;A1=Null;B1=Null; C1=Null; D1=Null;RunScheduledTask[myEnabled=True,{1}]], hintPanelExpr4[]}], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanelExpr4[a,b,c,d]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) (* better setup: Style[Manipulator[0.5, Appearance -> {"Open", Tiny}], DefaultOptions -> {Dynamic -> {BaseStyle -> Magnification -> 3}}] *) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] qPanel1[pn0_,a0_,b0_,aSym0_, bSym0_,hint0_]:= Module[{pn=pn0,text,aSym=aSym0,bSym=bSym0,hint=hint0,A1=False,B1=False,C1=False,D1=False,answer,a=a0,b=b0,myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True }, Style[Manipulate[ text={ToString[pn]<>". X is ", aSym, " and Y is ", bSym,"\nCalculate X + Y"}; text2=text/.{aSym->a, bSym->b}; text2=StringJoin[ToString/@text2]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={ToString[a+b+1],ToString[a+b-4],ToString[a+b],ToString[a+b+9]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{a,1,""}, (* initial value of a*) OpenerView[{Button["Try Again",qTryAgain[pn];a=RandomInteger[{1,5}];b=RandomInteger[{1,5}] ;myEnabled=True;A1=False; B1=False;C1=False; D1= False], hint}]&}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] qPanel2[pn0_,a0_,b0_,hint0_]:= Module[{pn=pn0,text,hint=hint0,A1=False,B1=False,C1=False,D1=False,answer,a=a0,b=b0,myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True }, Style[Manipulate[ text={ToString[pn]<>". An item in a store was priced at $", N[a,2], ". During a sale, its price is reduced by %", b,"\na) Determine is new price. \nb) If the H.S.T. is applied to the sale priced, determine the toal amount paid with tax included.(In Ontario H.S.T is 13%)"}; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={"a = $"<>ToString[N[a-a*0.7,2]]<>", b = $"<>ToString[N[1.13*(a-a*0.7),2]],"a = $"<>ToString[N[a-b,2]]<>", b = $"<>ToString[N[1.13*(a-b),2]],"a = $"<>ToString[N[a-a*b,2]]<>", b = $"<>ToString[N[1.13*(a-a*b),2]],"a = $"<>ToString[N[a-a*0.9,2]]<>", b = $"<>ToString[N[1.13*(a-a*0.9),2]]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{a,1,""}, (* initial value of a*) OpenerView[{Button["Try Again",qTryAgain[pn];a=RandomReal[N[{100.00,300.00},2]];b=RandomReal[N[{0.05, 0.5},2]] ;myEnabled=True;A1=False; B1=False;C1=False; D1= False], hint}]&}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] qPanel3[pn0_,a0_,b0_,c0_,d0_, p0_, hint0_]:= Module[{pn=pn0,text,hint=hint0,A1=False,B1=False,C1=False,D1=False,answer,a=a0,b=b0,c=c0,d=d0, p=p0,myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True }, Style[Manipulate[ text={ToString[pn]<>". Mrs. Johnson owned ", a,"/",b, " of a store. She sold ", c, "/",d," of her interest in the store for $",p, ". What was the total value of the store?" }; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={ToString[(1*b*20000/(c*b))+1000],ToString[(d*1*20000/(c*a))+2000],ToString[d*b*20000/(c*a)],ToString[(d*b*20000/(1*a))+1000]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{a,1,""}, (* initial value of a*) OpenerView[{Button["Try Again",qTryAgain[pn];a=RandomInteger[{1,10}];b=a+RandomInteger[{0,10}];c=RandomInteger[{1,10}];d=c+RandomInteger[{0,10}];p=RandomInteger[{30000,60000}] ;myEnabled=True;A1=False; B1=False;C1=False; D1= False], hint}]&}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] qPanel4[pn0_,b0_, c0_, d0_,hint0_]:= Module[{pn=pn0,text,hint=hint0,A1=False,B1=False,C1=False,D1=False,answer,b=b0,c=c0,d=d0, myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True }, Style[Manipulate[ text={ToString[pn]<>". If ", "a:b = ",c,":",d," and it is known that ","b = ", b, ", find the value of a." }; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={ToString[2*b*c/d],ToString[d/(b*c)],ToString[b*c/d],ToString[(b+c)/d]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{b,1,""}, (* initial value of a*) OpenerView[{Button["Try Again",qTryAgain[pn];b=RandomInteger[{50,300}];c=RandomInteger[{1, 20}];d=RandomInteger[{1, 20}];myEnabled=True;A1=False; B1=False;C1=False; D1= False], hint}]&}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] solutionPanel5[deposit0_,prevBalance0_,cheque10_,cheque20_,cheque30_,cheque40_, cheque50_,cheque60_,anotherDeposit0_,fee0_]:=Module[{deposit=deposit0,prevBalance=prevBalance0,cheque1=cheque10,cheque2=cheque20,cheque3=cheque30,cheque4=cheque40, cheque5=cheque50,cheque6=cheque60,anotherDeposit=anotherDeposit0,fee=fee0, body}, body={{ "Group the monies into positive or negative groups: \n", "deposit+prevBalance-(cheque1+cheque2+cheque3+cheque4+cheque5+cheque6)+anotherDeposit-fee"<>"\n", "= "<>ToString[deposit]<>"+"<>ToString[prevBalance]<>"-"<>"("<>ToString[cheque1]<>"+"<>ToString[cheque2]<>"+"<>ToString[cheque3]<>"+"<>ToString[cheque4]<>"+"<>ToString[cheque5]<>"+"<>ToString[cheque6]<>")"<>"+"<>ToString[anotherDeposit]<>"-"<>ToString[fee]<>"\n", "= "<>ToString[deposit]<>"+"<>ToString[prevBalance]<>"-"<>ToString[cheque1+cheque2+cheque3+cheque4+cheque5+cheque6]<>"+"<>ToString[anotherDeposit]<>"-"<>ToString[fee]<>"\n", "= "<>ToString[deposit+prevBalance]<>"-"<>ToString[cheque1+cheque2+cheque3+cheque4+cheque5+cheque6]<>"+"<>ToString[anotherDeposit]<>"-"<>ToString[fee]<>"\n", "= "<>ToString[deposit+prevBalance]<>"-"<>ToString[cheque1+cheque2+cheque3+cheque4+cheque5+cheque6]<>"+"<>ToString[anotherDeposit-fee]<>"\n", "= "<>ToString[deposit+prevBalance-(cheque1+cheque2+cheque3+cheque4+cheque5+cheque6)]<>"+"<>ToString[anotherDeposit-fee]<>"\n", "= "<>ToString[deposit+prevBalance-(cheque1+cheque2+cheque3+cheque4+cheque5+cheque6)+anotherDeposit-fee]<>"\n" } ,{Null,Null,Null,Null,Null,Null,Null,Null}}; Panel[Grid[Transpose[body]]] ] qPaneHint5[deposit0_,prevBalance0_,cheque10_,cheque20_,cheque30_,cheque40_, cheque50_,cheque60_,anotherDeposit0_,fee0_]:="Account Balance = (Total Deposits) - (Total Expenditures)" qPanel5[pn0_,deposit0_,prevBalance0_,cheque10_,cheque20_,cheque30_,cheque40_, cheque50_,cheque60_,anotherDeposit0_,fee0_,diag0_]:= DynamicModule[{pn=pn0,text,hint=hint0,A1=False,B1=False,C1=False,D1=False,answer,deposit=deposit0,prevBalance=prevBalance0,cheque1=cheque10,cheque2=cheque20,cheque3=cheque30,cheque4=cheque40, cheque5=cheque50,cheque6=cheque60,anotherDeposit=anotherDeposit0,fee=fee0,myEnabled=True,text2,variations,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True,person, state=False,diag=diag0,xxx,stateH=False }, qNum += 1; If[diag==False, Style[Manipulate[ xxx=xxx; person=qRandList[qNamesList]; variations={{ToString[pn]<>". "<>person[[1]]<>" has a chequing account. At the frist day of the month, deposited $",deposit," to a previous balance of ",qSign2[prevBalance], "$", Abs[prevBalance],". Later on wrote six cheques for $",cheque1, ", $", cheque2, ", $", cheque3, ", $",cheque4, ", $", cheque5, ", $", cheque6,". Because of holliday shopping had to make another deposit of $", anotherDeposit, ". If the bank service charge was $", fee, ", what was "<>person[[1]]<>"'s account balance at the end of the month?"}, {ToString[pn]<>". "<>person[[1]]<>" has a chequing account. In the beginning of the month, made a $",deposit," deposit to a previous balance of ",qSign2[prevBalance], "$", Abs[prevBalance],". And then wrote 6 cheques for $",cheque1, ", $", cheque2, ", $", cheque3, ", $",cheque4, ", $", cheque5, ", $", cheque6,". To cover additional expenses, made second deposit of $", anotherDeposit, ". The bank monthly fee is $", fee, ", calculate "<>person[[1]]<>"'s account balance at the end of the month?"}, {ToString[pn]<>". "<>person[[1]]<>" uses a chequing account. Last month, made a $",deposit," deposit to an existing balance of ",qSign2[prevBalance], "$", Abs[prevBalance],". Six cheques were written for $",cheque1, ", $", cheque2, ", $", cheque3, ", $",cheque4, ", $", cheque5, ", $", cheque6,". To assure positive balance, another deposit of $", anotherDeposit, " was made. The bank charges monthly fee of $", fee, ", what was "<>person[[1]]<>"'s chequing balance by the end of the month?"}, {ToString[pn]<>". "<>person[[1]]<>" pays bills by cheques. During the past month of May, deposited $",deposit," on top of the previous balance of ",qSign2[prevBalance], "$", Abs[prevBalance],". Had six bills, therefore wrote cheques for $",cheque1, ", $", cheque2, ", $", cheque3, ", $",cheque4, ", $", cheque5, ", $", cheque6,". The Revenue department sent a tax refund, thus "<>person[[1]]<>" deposited a refund cheque valued at $", anotherDeposit, ". The bank charges $", fee, " per month, what was "<>person[[1]]<>"'s account balance at the end May?"} }; text = qRandList[variations]; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={ "$"<>ToString[deposit+prevBalance-(cheque1+cheque2+cheque3+cheque4+cheque5+cheque6)+anotherDeposit], "$"<>ToString[deposit-(cheque1+cheque2+cheque3+cheque4+cheque5+cheque6)+anotherDeposit-fee], "$"<>ToString[deposit+prevBalance-(cheque1+cheque2+cheque3+cheque4+cheque5+cheque6)+anotherDeposit-fee], "$"<>ToString[deposit+prevBalance-(cheque1+cheque2+cheque3+cheque4+cheque5+cheque6)-fee]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{xxx,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];xxx=RandomReal[0.5];deposit=RandomInteger[{400,700}];prevBalance=RandomInteger[{-50,100}];cheque1=RandomInteger[{20,100}];cheque2=RandomInteger[{20,100}];cheque3=RandomInteger[{20,100}];cheque4=RandomInteger[{20,100}];cheque5=RandomInteger[{20,100}];cheque6=RandomInteger[{20,100}];anotherDeposit=RandomInteger[{100,300}];fee=RandomInteger[{10,25}] ;myEnabled=True;A1=False; B1=False;C1=False; D1= False], ""}], OpenerView[{Button["Hint",qTryAgain[pn];stateH=Not[stateH]],qPaneHint5[deposit,prevBalance,cheque1,cheque2,cheque3,cheque4, cheque5,cheque6,anotherDeposit,fee]},stateH], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanel5[deposit,prevBalance,cheque1,cheque2,cheque3,cheque4, cheque5,cheque6,anotherDeposit,fee]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}], Style[Manipulate[ deposit=RandomInteger[{400,700}];prevBalance=RandomInteger[{-50,100}];cheque1=RandomInteger[{20,100}];cheque2=RandomInteger[{20,100}];cheque3=RandomInteger[{20,100}];cheque4=RandomInteger[{20,100}];cheque5=RandomInteger[{20,100}];cheque6=RandomInteger[{20,100}];anotherDeposit=RandomInteger[{100,300}];fee=RandomInteger[{10,25}] ; person=qRandList[qNamesList]; variations={{ToString[pn]<>". "<>person[[1]]<>" has a chequing account. At the frist day of the month, deposited $",deposit," to a previous balance of ",qSign2[prevBalance], "$", Abs[prevBalance],". Later on wrote six cheques for $",cheque1, ", $", cheque2, ", $", cheque3, ", $",cheque4, ", $", cheque5, ", $", cheque6,". Because of holliday shopping had to make another deposit of $", anotherDeposit, ". If the bank service charge was $", fee, ", what was "<>person[[1]]<>"'s account balance at the end of the month?"}, {ToString[pn]<>". "<>person[[1]]<>" has a chequing account. In the beginning of the month, made a $",deposit," deposit to a previous balance of ",qSign2[prevBalance], "$", Abs[prevBalance],". And then wrote 6 cheques for $",cheque1, ", $", cheque2, ", $", cheque3, ", $",cheque4, ", $", cheque5, ", $", cheque6,". To cover additional expenses, made second deposit of $", anotherDeposit, ". The bank monthly fee is $", fee, ", calculate "<>person[[1]]<>"'s account balance at the end of the month?"}, {ToString[pn]<>". "<>person[[1]]<>" uses a chequing account. Last month, made a $",deposit," deposit to an existing balance of ",qSign2[prevBalance], "$", Abs[prevBalance],". Six cheques were written for $",cheque1, ", $", cheque2, ", $", cheque3, ", $",cheque4, ", $", cheque5, ", $", cheque6,". To assure positive balance, another deposit of $", anotherDeposit, " was made. The bank charges monthly fee of $", fee, ", what was "<>person[[1]]<>"'s chequing balance by the end of the month?"}, {ToString[pn]<>". "<>person[[1]]<>" pays bills by cheques. During the past month of May, deposited $",deposit," on top of the previous balance of ",qSign2[prevBalance], "$", Abs[prevBalance],". Had six bills, therefore wrote cheques for $",cheque1, ", $", cheque2, ", $", cheque3, ", $",cheque4, ", $", cheque5, ", $", cheque6,". The Revenue department sent a tax refund, thus "<>person[[1]]<>" deposited a refund cheque valued at $", anotherDeposit, ". The bank charges $", fee, " per month, what was "<>person[[1]]<>"'s account balance at the end May?"} }; text = qRandList[variations]; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"",B1,qClickPlus[pn];myEnabled=False;text2<>"",D1, myEnabled=False;qClickPlus[pn];text2<>"", True, text2<>""]]; answers={deposit+prevBalance-(cheque1+cheque2+cheque3+cheque4+cheque5+cheque6)+anotherDeposit,deposit-(cheque1+cheque2+cheque3+cheque4+cheque5+cheque6)+anotherDeposit-fee,deposit+prevBalance-(cheque1+cheque2+cheque3+cheque4+cheque5+cheque6)+anotherDeposit-fee,deposit+prevBalance-(cheque1+cheque2+cheque3+cheque4+cheque5+cheque6)-fee}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] qPanel5Diag[pn0_,deposit0_,prevBalance0_,cheque10_,cheque20_,cheque30_,cheque40_, cheque50_,cheque60_,anotherDeposit0_,fee0_]:= Module[{pn=pn0,text,hint=hint0,A1=False,B1=False,C1=False,D1=False,answer,deposit=deposit0,prevBalance=prevBalance0,cheque1=cheque10,cheque2=cheque20,cheque3=cheque30,cheque4=cheque40, cheque5=cheque50,cheque6=cheque60,anotherDeposit=anotherDeposit0,fee=fee0,myEnabled=True,text2,variations,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True,person, state=False,diag=diag0 }, Style[Manipulate[ person=qRandList[qNamesList]; variations={{ToString[pn]<>". "<>person[[1]]<>" has a chequing account. At the frist day of the month, deposited $",deposit," to a previous balance of ",qSign2[prevBalance], "$", Abs[prevBalance],". Later on wrote six cheques for $",cheque1, ", $", cheque2, ", $", cheque3, ", $",cheque4, ", $", cheque5, ", $", cheque6,". Because of holliday shopping had to make another deposit of $", anotherDeposit, ". If the bank service charge was $", fee, ", what was "<>person[[1]]<>"'s account balance at the end of the month?"}, {ToString[pn]<>". "<>person[[1]]<>" has a chequing account. In the beginning of the month, made a $",deposit," deposit to a previous balance of ",qSign2[prevBalance], "$", Abs[prevBalance],". And then wrote 6 cheques for $",cheque1, ", $", cheque2, ", $", cheque3, ", $",cheque4, ", $", cheque5, ", $", cheque6,". To cover additional expenses, made second deposit of $", anotherDeposit, ". The bank monthly fee is $", fee, ", calculate "<>person[[1]]<>"'s account balance at the end of the month?"}, {ToString[pn]<>". "<>person[[1]]<>" uses a chequing account. Last month, made a $",deposit," deposit to an existing balance of ",qSign2[prevBalance], "$", Abs[prevBalance],". Six cheques were written for $",cheque1, ", $", cheque2, ", $", cheque3, ", $",cheque4, ", $", cheque5, ", $", cheque6,". To assure positive balance, another deposit of $", anotherDeposit, " was made. The bank charges monthly fee of $", fee, ", what was "<>person[[1]]<>"'s chequing balance by the end of the month?"}, {ToString[pn]<>". "<>person[[1]]<>" pays bills by cheques. During the past month of May, deposited $",deposit," on top of the previous balance of ",qSign2[prevBalance], "$", Abs[prevBalance],". Had six bills, therefore wrote cheques for $",cheque1, ", $", cheque2, ", $", cheque3, ", $",cheque4, ", $", cheque5, ", $", cheque6,". The Revenue department sent a tax refund, thus "<>person[[1]]<>" deposited a refund cheque valued at $", anotherDeposit, ". The bank charges $", fee, " per month, what was "<>person[[1]]<>"'s account balance at the end May?"} }; text = qRandList[variations]; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={deposit+prevBalance-(cheque1+cheque2+cheque3+cheque4+cheque5+cheque6)+anotherDeposit,deposit-(cheque1+cheque2+cheque3+cheque4+cheque5+cheque6)+anotherDeposit-fee,deposit+prevBalance-(cheque1+cheque2+cheque3+cheque4+cheque5+cheque6)+anotherDeposit-fee,deposit+prevBalance-(cheque1+cheque2+cheque3+cheque4+cheque5+cheque6)-fee}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] qPanel5Rev[pn0_,deposit0_,prevBalance0_,cheque10_,cheque20_,cheque30_,cheque40_, cheque50_,cheque60_,anotherDeposit0_,fee0_]:= Module[{pn=pn0,text,hint=hint0,A1=False,B1=False,C1=False,D1=False,answer,deposit=deposit0,prevBalance=prevBalance0,cheque1=cheque10,cheque2=cheque20,cheque3=cheque30,cheque4=cheque40, cheque5=cheque50,cheque6=cheque60,anotherDeposit=anotherDeposit0,fee=fee0,myEnabled=True,text2,variations,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True,person, state=False,diag=diag0 }, Style[Manipulate[ person=qRandList[qNamesList]; variations={{ToString[pn]<>". "<>person[[1]]<>" has a chequing account. At the frist day of the month, deposited $",deposit," to a previous balance of ",qSign2[prevBalance], "$", Abs[prevBalance],". Later on wrote six cheques for $",cheque1, ", $", cheque2, ", $", cheque3, ", $",cheque4, ", $", cheque5, ", $", cheque6,". Because of holliday shopping had to make another deposit of $", anotherDeposit, ". If the bank service charge was $", fee, ", what was "<>person[[1]]<>"'s account balance at the end of the month?"}, {ToString[pn]<>". "<>person[[1]]<>" has a chequing account. In the beginning of the month, made a $",deposit," deposit to a previous balance of ",qSign2[prevBalance], "$", Abs[prevBalance],". And then wrote 6 cheques for $",cheque1, ", $", cheque2, ", $", cheque3, ", $",cheque4, ", $", cheque5, ", $", cheque6,". To cover additional expenses, made second deposit of $", anotherDeposit, ". The bank monthly fee is $", fee, ", calculate "<>person[[1]]<>"'s account balance at the end of the month?"}, {ToString[pn]<>". "<>person[[1]]<>" uses a chequing account. Last month, made a $",deposit," deposit to an existing balance of ",qSign2[prevBalance], "$", Abs[prevBalance],". Six cheques were written for $",cheque1, ", $", cheque2, ", $", cheque3, ", $",cheque4, ", $", cheque5, ", $", cheque6,". To assure positive balance, another deposit of $", anotherDeposit, " was made. The bank charges monthly fee of $", fee, ", what was "<>person[[1]]<>"'s chequing balance by the end of the month?"}, {ToString[pn]<>". "<>person[[1]]<>" pays bills by cheques. During the past month of May, deposited $",deposit," on top of the previous balance of ",qSign2[prevBalance], "$", Abs[prevBalance],". Had six bills, therefore wrote cheques for $",cheque1, ", $", cheque2, ", $", cheque3, ", $",cheque4, ", $", cheque5, ", $", cheque6,". The Revenue department sent a tax refund, thus "<>person[[1]]<>" deposited a refund cheque valued at $", anotherDeposit, ". The bank charges $", fee, " per month, what was "<>person[[1]]<>"'s account balance at the end May?"} }; text = qRandList[variations]; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={deposit+prevBalance-(cheque1+cheque2+cheque3+cheque4+cheque5+cheque6)+anotherDeposit,deposit-(cheque1+cheque2+cheque3+cheque4+cheque5+cheque6)+anotherDeposit-fee,deposit+prevBalance-(cheque1+cheque2+cheque3+cheque4+cheque5+cheque6)+anotherDeposit-fee,deposit+prevBalance-(cheque1+cheque2+cheque3+cheque4+cheque5+cheque6)-fee}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{deposit,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];deposit=RandomInteger[{400,700}];prevBalance=RandomInteger[{-50,100}];cheque1=RandomInteger[{20,100}];cheque2=RandomInteger[{20,100}];cheque3=RandomInteger[{20,100}];cheque4=RandomInteger[{20,100}];cheque5=RandomInteger[{20,100}];cheque6=RandomInteger[{20,100}];anotherDeposit=RandomInteger[{100,300}];fee=RandomInteger[{10,25}] ;myEnabled=True;A1=False; B1=False;C1=False; D1= False], ""}], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanel5[deposit,prevBalance,cheque1,cheque2,cheque3,cheque4, cheque5,cheque6,anotherDeposit,fee]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] qConstants={"one", "two", "three", "four", "five", "six", "seven"}; solutionPanel6[b0_,c0_]:=Module[{b=b0, c=c0, body}, body={{Text["Recurring monthly cost: "<>ToString[b]<>"\n"], Text["Number of such repeated billings: "<>ToString[c+1]<>"\n"], Text["Total = (Number of Months) \[Times] (Monthly Expense): " <>"\n"], Text[ToString[c+1]<> " \[Times] " <> ToString[b]<>" = "<>ToString[(c+1)*b]<>"\n"], DiscretePlot[b*x,{x, 0,c+1},AxesLabel->{"Months","Accumulted Bill"}]},{Null,Null,Null,Null,Null}}; Panel[Grid[Transpose[body]]] ] qPaneHint6[b_,c_]:="Total = (Monthly Expense) \[Times] (Number of Months)" qPanel6[pn0_,b0_, c0_,hint0_,diag0_]:= DynamicModule[{pn=pn0,text,hint=hint0,person, variations,A1=False,B1=False,C1=False,D1=False,answer,b=b0,c=c0,myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, state=False,diag=diag0,xxx,stateH=False }, qNum += 1; If[diag==False, Style[Manipulate[ xxx=xxx; person=qRandList[qNamesList]; variations={{ToString[pn]<>". ",person[[1]],"'s cell phone bill for every month is $",b,". For ",qConstants[[c+1]]," months, ",person[[2]]," has not been able to make any payments and Cell Phone Company is threatening to assign debt to a collection agency. Use your knownledge of integers to indicate how much ",person[[1]]," owes to the Cell Phone Company."}, {ToString[pn]<>". ",person[[1]],"'s cable bill for every month is $",b,". For ",qConstants[[c+1]]," months, ",person[[2]]," has not been able to make any payments and Cable Company is threatening to assign debt to a collection agency. Use your knownledge of integers to indicate how much ",person[[1]]," owes to the Cable Company."} }; text=qRandList[variations]; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={ "$"<>ToString[(b*c)-5], "$"<>ToString[b*(c-1)], "$"<>ToString[b*(c+1)],(*c+1 is the right answer because we do not have opiton 1 month*) "$"<>ToString[b*(c)]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{xxx,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];xxx=RandomReal[0.5];b=RandomInteger[{50,300}];c=RandomInteger[{1, Length[qConstants]-1}];myEnabled=True;A1=False; B1=False;C1=False; D1= False; state=False], hint}], OpenerView[{Button["Hint",qTryAgain[pn];stateH=Not[stateH]],qPaneHint6[b,c]},stateH], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanel6[b,c]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ b=RandomInteger[{50,300}];c=RandomInteger[{1, Length[qConstants]-1}]; person=qRandList[qNamesList]; variations={{ToString[pn]<>". ",person[[1]],"'s cell phone bill for every month is $",b,". For ",qConstants[[c+1]]," months, ",person[[2]]," has not been able to make any payments and Cell Phone Company is threatening to assign debt to a collection agency. Use your knownledge of integers to indicate how much ",person[[1]]," owes to the Cell Phone Company."}, {ToString[pn]<>". ",person[[1]],"'s cable bill for every month is $",b,". For ",qConstants[[c+1]]," months, ",person[[2]]," has not been able to make any payments and Cable Company is threatening to assign debt to a collection agency. Use your knownledge of integers to indicate how much ",person[[1]]," owes to the Cable Company."} }; text=qRandList[variations]; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"",B1,qClickPlus[pn];myEnabled=False;text2<>"",D1, myEnabled=False;qClickPlus[pn];text2<>"", True, text2<>""]]; answers={ToString[(b*c)-5],ToString[b*(c-1)],ToString[b*c],ToString[b*(c+1)]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] qPanel6Diag[pn0_,b0_, c0_,hint0_]:= Module[{pn=pn0,text,hint=hint0,person, variations,A1=False,B1=False,C1=False,D1=False,answer,b=b0,c=c0,myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, state=False,diag=diag0 }, Style[Manipulate[ person=qRandList[qNamesList]; variations={{ToString[pn]<>". ",person[[1]],"'s cell phone bill for every month is $",b,". For ",qConstants[[c+1]]," months, ",person[[2]]," has not been able to make any payments and Cell Phone Company is threatening to assign debt to a collection agency. Use your knownledge of integers to indicate how much ",person[[1]]," owes to the Cell Phone Company."}, {ToString[pn]<>". ",person[[1]],"'s cable bill for every month is $",b,". For ",qConstants[[c+1]]," months, ",person[[2]]," has not been able to make any payments and Cable Company is threatening to assign debt to a collection agency. Use your knownledge of integers to indicate how much ",person[[1]]," owes to the Cable Company."} }; text=qRandList[variations]; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={ToString[(b*c)-5],ToString[b*(c-1)],ToString[b*c],ToString[b*(c+1)]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] qPanel6Rev[pn0_,b0_, c0_,hint0_]:= Module[{pn=pn0,text,hint=hint0,person, variations,A1=False,B1=False,C1=False,D1=False,answer,b=b0,c=c0,myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, state=False,diag=diag0 }, Style[Manipulate[ person=qRandList[qNamesList]; variations={{ToString[pn]<>". ",person[[1]],"'s cell phone bill for every month is $",b,". For ",qConstants[[c+1]]," months, ",person[[2]]," has not been able to make any payments and Cell Phone Company is threatening to assign debt to a collection agency. Use your knownledge of integers to indicate how much ",person[[1]]," owes to the Cell Phone Company."}, {ToString[pn]<>". ",person[[1]],"'s cable bill for every month is $",b,". For ",qConstants[[c+1]]," months, ",person[[2]]," has not been able to make any payments and Cable Company is threatening to assign debt to a collection agency. Use your knownledge of integers to indicate how much ",person[[1]]," owes to the Cable Company."} }; text=qRandList[variations]; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={ToString[(b*c)-5],ToString[b*(c-1)],ToString[b*c],ToString[b*(c+1)]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{b,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];b=RandomInteger[{50,300}];c=RandomInteger[{1, Length[qConstants]-1}];myEnabled=True;A1=False; B1=False;C1=False; D1= False; state=False], hint}], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanel6[b,c]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] solutionPanel17[m0_]:=Module[{m=m0, body}, body={{ "Given a point (-1, 0), this means:\n", "x = "<>"-1 "<>"and y = 0\n", "Sub in (x, y) in y = "<>ToString[m]<>"x + b\n", "0 = "<>qSign[m]<>"(-1)"<> " + b = "<>qSign[-m]<>" + b = 0"<>"\n", "b = "<>qSign[m]<>"\n", "Let's plot and see if the solution is correct: \n", Plot[m*x+m,{x, -3,3},AxesLabel->{"x","y"},AxesOrigin->{0,0},Epilog->{PointSize[Medium],{Green,Point[{-1,0}]}}]},{Null,Null,Null,Null,Null,Null,Null}}; Panel[Grid[Transpose[body]]] ] qPaneHint17[m_]:="To solve for b, substitute the point given into y=mx+b" qPanel17[pn0_,m0_,diag0_]:= DynamicModule[{pn=pn0,text,A1=False,B1=False,C1=False,D1=False,answer,m=m0,myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, state=False, diag=diag0,stateH=False}, qNum += 1; If[diag==False, Style[Manipulate[ text={ToString[pn]<>". If point (-1, 0) is on the line whose equation is y = ",qSign[m],"x + b, what is the value of b?"}; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={ToString[m+2],ToString[m-1],ToString[m],ToString[m+1]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{m,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];m=RandomInteger[{1,4}]*(-1)^RandomInteger[{1,4}];myEnabled=True;A1=False; B1=False;C1=False; D1= False; state=False], "y = mx + b, plug some values for x and y "}], OpenerView[{Button["Hint",qTryAgain[pn];stateH=Not[stateH]],qPaneHint17[m]},stateH], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanel17[m]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ m=RandomInteger[{1,4}]*(-1)^RandomInteger[{1,4}]; text={ToString[pn]<>". If point (-1, 0) is on the line whose equation is y = ",ToString[m],"x + b, what is the value of b?"}; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"",B1,qClickPlus[pn];myEnabled=False;text2<>"",D1, myEnabled=False;qClickPlus[pn];text2<>"", True, text2<>""]]; answers={ToString[m+2],ToString[m-1],ToString[m],ToString[m+1]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] solutionPanelFrac1[a0_,b0_, c0_]:=Module[{a=a0,b=b0, c=c0, body}, body={{ToString[1-1/ToString[a], StandardForm]<>" = "ToString[1-(1/a), StandardForm]<>"\n", ToString[1-1/ToString[b], StandardForm]<>" = "ToString[1-(1/b), StandardForm]<>"\n", ToString[1-1/ToString[c], StandardForm]<>" = "ToString[1-(1/c), StandardForm]<>"\n", ToString[1-(1/a), StandardForm]<>"\[Times]"<>ToString[1-(1/b), StandardForm]<>"\[Times]"<>ToString[1-(1/c), StandardForm]<>" = "<>ToString[(1-(1/a))*(1-(1/b))*(1-(1/c)), StandardForm]<>"\n"}, {Null, Null, Null,Null}}; Panel[Grid[Transpose[body]]] ] hintPanelFrac1[]:=Module[{ body}, body={{ToString[1-1/("a"), StandardForm]<>" = "ToString[("a-1")/("a"), StandardForm]<>"\n"}, {Null}}; Panel[Grid[Transpose[body]]] ] qPanelFrac1[pn0_,a0_,b0_, c0_,diag0_]:= DynamicModule[{pn=pn0,text,A1=False,B1=False,C1=False,D1=False,answer,a=a0,aprev=a0,b=b0,c=c0,myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, state=False,diag=diag0,xxx }, If[diag==False, Style[Manipulate[ xxx=xxx; (* list format and string join messes up the StandardForm *) text=ToString[pn]<>". What is the value of product "<> "("<>ToString[1-1/ToString[a], StandardForm]<>")"<>"("<>ToString[1-1/ToString[b], StandardForm]<>")"<>"("<> ToString[1-1/ToString[c], StandardForm]<>")"<>" ?"; text2=text; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nCheck the correct answer"]]; answers={ToString[(1-(1/a))*(1-(1/b))*(1-(1/a)), StandardForm],ToString[(1-(1/a))*(1-(1/c))*(1-(1/c)), StandardForm],ToString[(1-(1/a))*(1-(1/b))*(1-(1/c)), StandardForm],ToString[(1-(1/a))*(1-(1/b))*(1-(1/b)), StandardForm]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{xxx,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];While[a==aprev,a=RandomInteger[{2,10}]];xxx=RandomReal[0.5];aprev=a;b=RandomInteger[{2,10}];c=RandomInteger[{2,10}];myEnabled=True;A1=False; B1=False;C1=False; D1= False; state=False], hintPanelFrac1[]}], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanelFrac1[a,b,c]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ (* list format and string join messes up the StandardForm *) text=ToString[pn]<>". What is the value of product "<> "("<>ToString[1-1/ToString[a], StandardForm]<>")"<>"("<>ToString[1-1/ToString[b], StandardForm]<>")"<>"("<> ToString[1-1/ToString[c], StandardForm]<>")"<>" ?"; text2=text; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nCheck the correct answer"]]; answers={ToString[(1-(1/a))*(1-(1/b))*(1-(1/a)), StandardForm],ToString[(1-(1/a))*(1-(1/c))*(1-(1/c)), StandardForm],ToString[(1-(1/a))*(1-(1/b))*(1-(1/c)), StandardForm],ToString[(1-(1/a))*(1-(1/b))*(1-(1/b)), StandardForm]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] solutionPanelFrac1v2[a0_,b0_, c0_]:=Module[{a=a0,b=b0, c=c0, body}, body={{ToString[1+1/ToString[a], StandardForm]<>" = "ToString[1+(1/a), StandardForm]<>"\n", ToString[1-1/ToString[b], StandardForm]<>" = "ToString[1-(1/b), StandardForm]<>"\n", ToString[1+1/ToString[c], StandardForm]<>" = "ToString[1+(1/c), StandardForm]<>"\n", ToString[1+(1/a), StandardForm]<>"\[Times]"<>ToString[1-(1/b), StandardForm]<>"\[Times]"<>ToString[1+(1/c), StandardForm]<>" = "<>ToString[(1+(1/a))*(1-(1/b))*(1+(1/c)), StandardForm]<>"\n"}, {Null, Null, Null,Null}}; Panel[Grid[Transpose[body]]] ] hintPanelFrac1v2[]:=Module[{ body}, body={{ToString[1+1/("a"), StandardForm]<>" = "ToString[("a+1")/("a"), StandardForm]<>"\n"}, {Null}}; Panel[Grid[Transpose[body]]] ] qPanelFrac1v2[pn0_,a0_,b0_, c0_,diag0_]:= DynamicModule[{pn=pn0,text,A1=False,B1=False,C1=False,D1=False,answer,a=a0,aprev=a0,b=b0,c=c0,myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, state=False,diag=diag0,xxx }, qNum += 1; If[diag==False, Style[Manipulate[ xxx=xxx; (* list format and string join messes up the StandardForm *) text=ToString[pn]<>". What is the value of product "<> "("<>ToString[1+1/ToString[a], StandardForm]<>")"<>"("<>ToString[1-1/ToString[b], StandardForm]<>")"<>"("<> ToString[1+1/ToString[c], StandardForm]<>")"<>" ?"; text2=text; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer?"]]; answers={ToString[(1+(1/a))*(1-(1/b))*(1+(1/c))/2, StandardForm],ToString[(1+(1/a))*(1-(1/b))*(1+(1/c))*3, StandardForm],ToString[(1+(1/a))*(1-(1/b))*(1+(1/c)), StandardForm],ToString[(1+(1/a))*(1-(1/b))*(1+(1/c))*2, StandardForm]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{xxx,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];While[a==aprev,a=RandomInteger[{2,3}]];xxx=RandomReal[0.5];aprev=a;b=RandomInteger[{3,5}];c=RandomInteger[{3,5}];myEnabled=True;A1=False; B1=False;C1=False; D1= False; state=False], hintPanelFrac1v2[]}], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanelFrac1v2[a,b,c]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ b=RandomInteger[{3,5}];c=RandomInteger[{3,5}]; (* list format and string join messes up the StandardForm *) text=ToString[pn]<>". What is the value of product "<> "("<>ToString[1+1/ToString[a], StandardForm]<>")"<>"("<>ToString[1-1/ToString[b], StandardForm]<>")"<>"("<> ToString[1+1/ToString[c], StandardForm]<>")"<>" ?"; text2=text; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"",B1,qClickPlus[pn];myEnabled=False;text2<>"",D1, myEnabled=False;qClickPlus[pn];text2<>"", True, text2<>""]]; answers={ToString[(1+(1/a))*(1-(1/b))*(1+(1/c))/2, StandardForm],ToString[(1+(1/a))*(1-(1/b))*(1+(1/c))*3, StandardForm],ToString[(1+(1/a))*(1-(1/b))*(1+(1/c)), StandardForm],ToString[(1+(1/a))*(1-(1/b))*(1+(1/c))*2, StandardForm]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>({{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] solutionPanelFrac1v3[a0_,b0_, c0_,d0_]:=Module[{a=a0,b=b0, c=c0, d=d0, body,x,y, a1,b1,c1,d1}, x = Numerator[((a/b)+(c/d))/2]; y = Denominator[((a/b)+(c/d))/2]; If[a/b < c/d, a1=a;b1=b;c1=c;d1=d]; If[a/b > c/d, a1=c;b1=d;c1=a;d1=b]; body={{ "To solve if "<> "\!\(\*FractionBox[\(a\), \(b\)]\) < \!\(\*FractionBox[\(x\), \(y\)]\) < \!\(\*FractionBox[\(c\), \(d\)]\)" <> " two tests are necessary:\n", "i. ay < bx \[DoubleLongRightArrow] \!\(\*FractionBox[\(a\), \(b\)]\) < \!\(\*FractionBox[\(x\), \(y\)]\) \n", "ii. xd < yc \[DoubleLongRightArrow] \!\(\*FractionBox[\(x\), \(y\)]\) < \!\(\*FractionBox[\(c\), \(d\)]\)\n", "Note: "<> ToString[ToString[a1]/ToString[b1],StandardForm]<> " < "<> ToString[ToString[c1]/ToString[d1],StandardForm]<>"\n", ToString[ToString[a1]/ToString[b1],StandardForm]<> " < "<>ToString[ToString[x]/ToString[y],StandardForm]<>" < "<>ToString[ToString[c1]/ToString[d1],StandardForm], "\nSince "<>ToString[((a/b)+(c/d))/2, StandardForm] <> " satisfies both tests: \n", "i. "<> ToString[a1]<>" \[CenterDot] "<>ToString[y]<>" < "<>ToString[b1]<>" \[CenterDot] "<>ToString[x], "ii. "<> ToString[x]<>" \[CenterDot] "<>ToString[d1]<>" < "<>ToString[y]<>" \[CenterDot] "<>ToString[c1] }, {Null, Null, Null,Null, Null,Null,Null,Null}}; Panel[Grid[Transpose[body]]] ] qPanelFrac1v3[pn0_,a0_,b0_, c0_,d0_,diag0_]:= DynamicModule[{pn=pn0,text,A1=False,B1=False,C1=False,D1=False,answer,a=a0,aprev=a0,b=b0,c=c0,d=d0,myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, state=False,diag=diag0,xxx }, If[diag==False, Style[Manipulate[ xxx=xxx; (* list format and string join messes up the StandardForm *) text=ToString[pn]<>". Which of the following is a fraction between "<>ToString[ToString[a]/ToString[b],StandardForm]<>" and "<>ToString[ToString[c]/ToString[d],StandardForm]<>" ?"; text2=text; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nCheck the correct answer"]]; answers={ToString[Min[a/b,c/d]/2, StandardForm],ToString[Abs[((a/b)-(c/d))/2]+Max[a/b,c/d], StandardForm],ToString[((a/b)+(c/d))/2, StandardForm],ToString[Abs[((a/b)-(c/d))/3]+Max[a/b,c/d], StandardForm]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{xxx,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];While[a==aprev,a=RandomInteger[{2,3}]];xxx=RandomReal[0.5];aprev=a;b=a+1;c=a+1;d=c+RandomInteger[{1,2}];myEnabled=True;A1=False; B1=False;C1=False; D1= False; state=False], ""}], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanelFrac1v3[a,b,c,d]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ (* list format and string join messes up the StandardForm *) text=ToString[pn]<>". What is the value of product "<> "("<>ToString[1+1/ToString[a], StandardForm]<>")"<>"("<>ToString[1-1/ToString[b], StandardForm]<>")"<>"("<> ToString[1+1/ToString[c], StandardForm]<>")"<>" ?"; text2=text; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nCheck the correct answer"]]; answers={ToString[Min[a/b,c/d]/2, StandardForm],ToString[Abs[((a/b)-(c/d))/2]+Max[a/b,c/d], StandardForm],ToString[((a/b)+(c/d))/2, StandardForm],ToString[Abs[((a/b)-(c/d))/3]+Max[a/b,c/d], StandardForm]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] solutionPanelFrac2[pnum0_,a0_]:=Module[{pnum=pnum0,a=a0,body}, body={{ToString[pnum[[6]]/pnum[[8]], StandardForm]<>" = "<>ToString[ToString[a]<>"\[Times]"<>ToString[pnum[[6]]]/ToString[a]<>"\[Times]"<>ToString[pnum[[8]]], StandardForm]<>" = "<>ToString[ToString[a*pnum[[6]], StandardForm]/ToString[a*pnum[[8]], StandardForm], StandardForm]}, {Null}}; Panel[Grid[Transpose[body]]] ] hintPanelFrac2[]:=Module[{body}, body={{ToString[ToString["a\[Times]p", StandardForm]/ToString["a\[Times]q", StandardForm], StandardForm]<>" = "<>ToString[ToString["p", StandardForm]/ToString["q", StandardForm], StandardForm]}, {Null}}; Panel[Grid[Transpose[body]]] ] qPanelFrac2[pn0_,diag0_]:= DynamicModule[{pn=pn0,text,pnum,A1=False,B1=False,C1=False,D1=False,answer,myEnabled=True,a=2,aprev,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True,indexpnum, state=False,diag=diag0 , xxx}, aprev=a; (* get some prime numers *) pnum=Table[Prime[n],{n,15}]; If[diag==False, Style[Manipulate[ xxx=xxx; (* list format and string join messes up the StandardForm *) text=ToString[pn]<>". Which of the following pair of fractions is equivalent \n"; text2=text; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nCheck the correct answer"]]; answers={ToString[pnum[[7]]/pnum[[9]], StandardForm]<>", "<>ToString[ToString[pnum[[6]], StandardForm]/ToString[a*pnum[[11]], StandardForm], StandardForm], ToString[pnum[[1]]/pnum[[15]], StandardForm]<>", "<>ToString[ToString[3*pnum[[12]], StandardForm]/ToString[3*pnum[[13]], StandardForm], StandardForm], ToString[pnum[[6]]/pnum[[8]], StandardForm]<>", "<>ToString[ToString[a*pnum[[6]], StandardForm]/ToString[a*pnum[[8]], StandardForm], StandardForm], ToString[2*pnum[[4]]/3*pnum[[9]], StandardForm]<>", "<>ToString[ToString[2*pnum[[7]], StandardForm]/ToString[2*pnum[[11]], StandardForm], StandardForm]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{xxx,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];xxx=RandomReal[0.5];indexpnum=RandomSample[Range[Length[pnum]]];pnum=Table[pnum[[indexpnum[[i]]]], {i, 1,Length[pnum]}];While[a==aprev,a=RandomInteger[{3,6}]];aprev=a;myEnabled=True;A1=False; B1=False;C1=False; D1= False; state=False], hintPanelFrac2[]}], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanelFrac2[pnum,a]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ (* list format and string join messes up the StandardForm *) text=ToString[pn]<>". Which of the following pair of fractions is equivalent \n"; text2=text; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nCheck the correct answer"]]; answers={ToString[pnum[[7]]/pnum[[9]], StandardForm]<>", "<>ToString[ToString[pnum[[6]], StandardForm]/ToString[a*pnum[[11]], StandardForm], StandardForm], ToString[pnum[[1]]/pnum[[15]], StandardForm]<>", "<>ToString[ToString[3*pnum[[12]], StandardForm]/ToString[3*pnum[[13]], StandardForm], StandardForm], ToString[pnum[[6]]/pnum[[8]], StandardForm]<>", "<>ToString[ToString[a*pnum[[6]], StandardForm]/ToString[a*pnum[[8]], StandardForm], StandardForm], ToString[2*pnum[[4]]/3*pnum[[9]], StandardForm]<>", "<>ToString[ToString[2*pnum[[7]], StandardForm]/ToString[2*pnum[[11]], StandardForm], StandardForm]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] solutionPanelFrac3[a0_,b0_,c0_]:=Module[{a=a0, b=b0,c=c0,body,x}, body={ { "Set up a ratio:\n", ToString[(ToString[a]<>" hours")/(ToString[ToString[b]/ToString[c],StandardForm]<> " of the volume"),StandardForm]<> " = "<> (ToString["x hours"/ToString[HoldForm[x/x]/.{x->ToString[c]},StandardForm], StandardForm]), "\nCross Multiply: \n", ToString[ToString[b]/ToString[c],StandardForm]<>"x = "<>ToString[a]<>" \[CenterDot] 1", "\nx = " <> ToString[a]<>" \[CenterDot] "<>ToString["1"/ToString[ToString[b]/ToString[c],StandardForm],StandardForm], "\nx = " <> ToString[a]<>" \[CenterDot] "<>ToString[ToString[c]/ToString[b],StandardForm], "\nx = "<>ToString[a*c/b,StandardForm] }, {Null,Null,Null,Null,Null,Null,Null}}; Panel[Grid[Transpose[body]]] ] hintPanelFrac3[]:=Module[{body}, body={{ToString[ToString["a\[Times]p", StandardForm]/ToString["a\[Times]q", StandardForm], StandardForm]<>" = "<>ToString[ToString["p", StandardForm]/ToString["q", StandardForm], StandardForm]}, {Null}}; Panel[Grid[Transpose[body]]] ] qPanelFrac3[pn0_,a0_,b0_,c0_,diag0_]:= DynamicModule[{pn=pn0,text,pnum,variations,A1=False,B1=False,C1=False,D1=False,a=a0, aprev=a0, b=b0,c=c0,answer,myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True,indexpnum, state=False,diag=diag0,xxx }, If[diag==False, Style[Manipulate[ xxx=xxx; (* list format and string join messes up the StandardForm *) variations={ToString[pn]<>". It takes "<>ToString[a]<>" hours to fill "<>ToString[ToString[b]/ToString[c],StandardForm]<>" of a swimming pool. At this rate, how long will it take to fill the whole swimming pool?"<>" \n", ToString[pn]<>". It takes "<>ToString[a]<>" hours to fuel "<>ToString[ToString[b]/ToString[c],StandardForm]<>" of a cruise ship. At this rate, how long will it take to fuel up the ship completely ? "<>" \n" }; text=qRandList[variations]; text2=text; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nCheck the correct answer "]]; answers={ToString[Simplify[a*b/(c+1)], StandardForm], ToString[Simplify[(a+1)*c/b], StandardForm], ToString[Simplify[a*c/b], StandardForm], ToString[Simplify[a*(c+1)/(b+1)], StandardForm]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{xxx,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];While[a==aprev,a=RandomInteger[{3,6}]];xxx=RandomReal[0.5];aprev=a;b=RandomInteger[{1,5}];c=b+RandomInteger[{1,4}];myEnabled=True;A1=False; B1=False;C1=False; D1= False; state=False], "Duration \[Times] Rate = Amount \n"}], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanelFrac3[a,b,c]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ (* list format and string join messes up the StandardForm *) variations={ToString[pn]<>". It takes "<>ToString[a]<>" hours to fill "<>ToString[ToString[b]/ToString[c],StandardForm]<>" of a swimming pool. At this rate, how long will it take to fill the whole swimming pool?"<>" \n", ToString[pn]<>". It takes "<>ToString[a]<>" hours to fuel "<>ToString[ToString[b]/ToString[c],StandardForm]<>" a cruise ship. At this rate, how long will it take to fuel up the ship completely ? "<>" \n" }; text=qRandList[variations]; text2=text; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nCheck the correct answer"]]; answers={ToString[Simplify[a*b/(c+1)], StandardForm], ToString[Simplify[(a+1)*c/b], StandardForm], ToString[Simplify[a*c/b], StandardForm], ToString[Simplify[a*(c+1)/(b+1)], StandardForm]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] solutionPanelFrac4[a0_,b0_,c0_,d0_,e0_,f0_]:=Module[{a=a0, b=b0,c=c0,d=d0,e=e0,f=f0,body}, body={{"Multiply the numerators (upstairs): "<>"\n", ToString[a]<>"\[Times]"<>ToString[c]<>"\[Times]"<>ToString[e]<>" = "<>ToString[a*c*e]<>"\n", "Multiply the denominators (downstairs)\n", ToString[b]<>"\[Times]"<>ToString[d]<>"\[Times]"<>ToString[f]<>" = "<>ToString[b*d*f]<>"\n", "Divide: "<>ToString[ToString[a*c*e]/ToString[b*d*f], StandardForm]<>"\n", "Simplify: "<>ToString[Simplify[(a*c*e)/(b*d*f)], StandardForm] }, {Null,Null,Null,Null,Null,Null}}; Panel[Grid[Transpose[body]]] ] qPanelFrac4[pn0_,a0_,b0_, c0_,d0_,e0_,f0_,diag0_]:= DynamicModule[{pn=pn0,text,A1=False,B1=False,C1=False,D1=False,answer,a=a0,aprev=a0,b=b0,c=c0,d=d0,e=e0,f=f0,myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, state=False,diag=diag0 ,xxx}, qNum += 1; If[diag==False, Style[Manipulate[ xxx=xxx; (* list format and string join messes up the StandardForm *) text=ToString[pn]<>". What is the value of product "<> "("<>ToString[ToString[a]/ToString[b], StandardForm]<>")"<>"("<>ToString[ToString[c]/ToString[d], StandardForm]<>")"<>"("<> ToString[ToString[e]/ToString[f], StandardForm]<>")"<>" ?"; text2=text; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer?"]]; answers={ToString[Simplify[(a*c*e)/(b*d*f*2)], StandardForm],ToString[Simplify[3*(a*c*e)/(b*d*f)], StandardForm], ToString[Simplify[(a*c*e)/(b*d*f)], StandardForm], ToString[Simplify[2*(a*c*e)/(b*d*f)], StandardForm]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{xxx,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];While[a==aprev,a=RandomInteger[{2,5}]];xxx=RandomReal[0.5];aprev=a;b=a+RandomInteger[{1,2}];c=RandomInteger[{2,5}];d=c+RandomInteger[{1,2}];e=RandomInteger[{2,5}];f=e+RandomInteger[{1,2}];myEnabled=True;A1=False; B1=False;C1=False; D1= False; state=False], ToString["p"/"q", StandardForm]<>"\[Times]"ToString["r"/"s", StandardForm]<>" = "<>ToString["p\[Times]r"/"q\[Times]s", StandardForm]}], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanelFrac4[a,b,c,d,e,f]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ b=a+RandomInteger[{1,2}];c=RandomInteger[{2,5}];d=c+RandomInteger[{1,2}];e=RandomInteger[{2,5}];f=e+RandomInteger[{1,2}]; (* list format and string join messes up the StandardForm *) text=ToString[pn]<>". What is the value of product "<> "("<>ToString[ToString[a]/ToString[b], StandardForm]<>")"<>"("<>ToString[ToString[c]/ToString[d], StandardForm]<>")"<>"("<> ToString[ToString[e]/ToString[f], StandardForm]<>")"<>" ?"; text2=text; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"",B1,qClickPlus[pn];myEnabled=False;text2<>"",D1, myEnabled=False;qClickPlus[pn];text2<>"", True, text2<>""]]; answers={ToString[Simplify[(a*c*e)/(b*d*f*2)], StandardForm],ToString[Simplify[3*(a*c*e)/(b*d*f)], StandardForm], ToString[Simplify[(a*c*e)/(b*d*f)], StandardForm], ToString[Simplify[2*(a*c*e)/(b*d*f)], StandardForm]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] solutionPanelFrac5[a0_,b0_,c0_,d0_]:=Module[{a=a0, b=b0,c=c0,d=d0,body}, body={{"Flip the fraction to the right of \[Divide] : \n", ToString[ToString[c]/ToString[d], StandardForm]<>"\[LongRightArrow]"ToString[ToString[d]/ToString[c], StandardForm]<>"\n", "Then multiply the fractions and simplify: \n", ToString[ToString[c]/ToString[d], StandardForm]<>"\[Times]"ToString[ToString[d]/ToString[c], StandardForm]<>" = "<>ToString[Simplify[(a*d)/(b*c)],StandardForm]}, {Null,Null,Null,Null}}; Panel[Grid[Transpose[body]]] ] qPanelFrac5[pn0_,a0_,b0_, c0_,d0_,diag0_]:= DynamicModule[{pn=pn0,text,A1=False,B1=False,C1=False,D1=False,answer,a=a0,aprev=a0,b=b0,c=c0,d=d0,myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, state=False,diag=diag0,xxx }, qNum += 1; If[diag==False, Style[Manipulate[ xxx=xxx; (* list format and string join messes up the StandardForm *) text=ToString[pn]<>". Calculate and simplify "<>ToString[ToString[a]/ToString[b], StandardForm]<>"\[Divide]"<>ToString[ToString[c]/ToString[d], StandardForm]; text2=text; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer?"]]; answers={ToString[Simplify[(2*a*d)/(b*c)],StandardForm],ToString[Simplify[((a+1)*(d+1))/(b*(c+1))],StandardForm], ToString[Simplify[(a*d)/(b*c)],StandardForm], ToString[Simplify[(a*(d+1))/((b+1)*(c+1))],StandardForm]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{xxx,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];While[a==aprev,a=RandomInteger[{2,10}]];xxx=RandomReal[0.5];aprev=a;b=a+RandomInteger[{1,3}];c=RandomInteger[{2,10}];d=c+RandomInteger[{1,3}];myEnabled=True;A1=False; B1=False;C1=False; D1= False; state=False], ToString["1", StandardForm]<>"\[Divide]"ToString["r"/"s", StandardForm]<>" = "<>ToString["s"/"r", StandardForm]}], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanelFrac5[a,b,c,d]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ b=a+RandomInteger[{1,3}];c=RandomInteger[{2,10}];d=c+RandomInteger[{1,3}]; (* list format and string join messes up the StandardForm *) text=ToString[pn]<>". Calculate and simplify "<>ToString[ToString[a]/ToString[b], StandardForm]<>"\[Divide]"<>ToString[ToString[c]/ToString[d], StandardForm]; text2=text; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"",B1,qClickPlus[pn];myEnabled=False;text2<>"",D1, myEnabled=False;qClickPlus[pn];text2<>"", True, text2<>""]]; answers={ToString[Simplify[(2*a*d)/(b*c)],StandardForm],ToString[Simplify[((a+1)*(d+1))/(b*(c+1))],StandardForm], ToString[Simplify[(a*d)/(b*c)],StandardForm], ToString[Simplify[(a*(d+1))/((b+1)*(c+1))],StandardForm]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] solutionPanelFracRadical1[a0_,b0_]:=Module[{a=a0, b=b0,body}, body={{"Change "<>ToString[ToString[a]<>ToString[1/ToString[b^2], StandardForm], StandardForm]<>" as an improper fraction.\n", ToString[Sqrt[ToString[a]<>ToString[1/ToString[b^2], StandardForm]], StandardForm]<>" becomes "<>ToString[Sqrt[ToString[ToString[a]<>"\[Times]"<>ToString[b^2]<>" + 1"/ToString[b^2],StandardForm]], StandardForm]<>" = "<> ToString[Sqrt[ToString[a*(b^2)+1]/ToString[b^2]], StandardForm]<>"\n", ToString[Sqrt[ToString[a*(b^2)+1]/ToString[b^2]], StandardForm]<>" = "<>ToString[ToString[ToString[Sqrt[ToString[a*(b^2)+1]],StandardForm],StandardForm]/ToString[ToString[Sqrt[ToString[b^2]],StandardForm],StandardForm],StandardForm]<>" = "<>ToString[ Sqrt[(a*(b^2)+1)/b^2], StandardForm] }, {Null,Null,Null}}; Panel[Grid[Transpose[body]]] ] (* this cannot be a dynamic module, since causes problems with values of a and b*) helperFrac1[]:=Module[{a,b,list}, list={}; Table[If[IntegerQ[Sqrt[1+a b^2]]== True, AppendTo[list, {a,b}]], {a, 1, 11}, {b, 2, 11}] ; list ] qPanelFracRadical1[pn0_,a0_,b0_,diag0_]:= DynamicModule[{pn=pn0,text,A1=False,B1=False,C1=False,D1=False,answer,a=a0,aprev=a0,b=b0,myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, state=False,diag=diag0,xxx,list, n,i }, qNum += 1; list=helperFrac1[]; (* all the possible solutions to make sure we get nice p/q fractions for answers *) n = Length[list]; If[diag==False, Style[Manipulate[ xxx=xxx; (* list format and string join messes up the StandardForm *) text=ToString[pn]<>". Which of the following represents "<>ToString[Sqrt[ToString[a]<>ToString[1/ToString[b^2], StandardForm]], StandardForm]<>"as a fraction in lowest terms?"; text2=text; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer?"]]; answers={ToString[Simplify[1+Sqrt[a+(1/b^2)]],StandardForm],ToString[2*Simplify[Sqrt[a+(1/b^2)]],StandardForm], ToString[Simplify[Sqrt[a+(1/b^2)]],StandardForm], ToString[Simplify[1/Sqrt[a+(1/b^2)]],StandardForm]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[j]]]], {j, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[j]]]], {j, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{xxx,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];xxx=RandomReal[0.5];While[a==aprev,i=RandomInteger[{1,n}];a=list[[i]][[1]]];aprev=a;b=list[[i]][[2]];myEnabled=True;A1=False; B1=False;C1=False; D1= False; state=False], ""}], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanelFracRadical1[a,b]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ i=RandomInteger[{1,n}];a=list[[i]][[1]];b=list[[i]][[2]]; (* list format and string join messes up the StandardForm *) text=ToString[pn]<>". Which of the following represents "<>ToString[Sqrt[ToString[a]<>ToString[1/ToString[b^2], StandardForm]], StandardForm]<>"as a fraction in lowest terms?"; text2=text; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"",B1,qClickPlus[pn];myEnabled=False;text2<>"",D1, myEnabled=False;qClickPlus[pn];text2<>"", True, text2<>""]]; answers={ToString[Simplify[1+Sqrt[a+(1/b^2)]],StandardForm],ToString[2*Simplify[Sqrt[a+(1/b^2)]],StandardForm], ToString[Simplify[Sqrt[a+(1/b^2)]],StandardForm], ToString[Simplify[1/Sqrt[a+(1/b^2)]],StandardForm]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[j]]]], {j, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[j]]]], {j, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] solutionPanelFrac6[a0_,b0_,c0_,d0_,e0_,f0_,h0_]:=Module[{a=a0, b=b0,c=c0,d=d0,e=e0,f=f0,h=h0,body}, body={{"Multiply all denominators to obtain a common denominator: \n", ToString[a]<>"\[Times]"<>ToString[b]<>"\[Times]"<>ToString[c]<>" = "<>ToString[a*b*c]<>"\n", "Add the numerators times the common denominator: \n", "1"<>"\[Times]"<>ToString[a*b*c]<>"+"<>ToString[f]<>"\[Times]"<>ToString[a*b*c]<>"+"<>ToString[h]<>"\[Times]"<>ToString[a*b*c]<>"\n", "Divide and simplify the combination numerators and denominators: \n", ToString[Simplify[(1/a)+(f/b)+(h/c)],StandardForm] }, {Null,Null,Null,Null,Null,Null}}; Panel[Grid[Transpose[body]]] ] qPanelFrac6[pn0_,a0_,b0_, c0_,d0_, e0_,f0_,h0_,diag0_]:= DynamicModule[{pn=pn0,text,A1=False,B1=False,C1=False,D1=False,answer,a=a0,aprev=a0,b=b0,c=c0,d=d0,e=e0,f=f0,h=h0,myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, state=False,diag=diag0,xxx }, qNum +=1; If[diag==False, Style[Manipulate[ xxx=xxx; (* list format and string join messes up the StandardForm *) text=ToString[pn]<>". Calculate and simplify "<>ToString[ToString[1]/ToString[a], StandardForm]<>"+"<>ToString[ToString[f]/ToString[b], StandardForm]<>"+"<>ToString[ToString[h]/ToString[c], StandardForm]; text2=text; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer?"]]; answers={ToString[Simplify[(2/a)+(f/b)+(h/c)],StandardForm],ToString[Simplify[2+(1/a)+(f/b)+(h/c)],StandardForm], ToString[Simplify[(1/a)+(f/b)+(h/c)],StandardForm], ToString[Simplify[1+(1/a)+(f/b)+(h/c)],StandardForm]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{xxx,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];While[a==aprev,a=RandomInteger[{2,5}]];xxx=RandomReal[0.5];aprev=a;b=RandomInteger[{2,3}];c=RandomInteger[{2,4}];d=RandomInteger[{2,4}];e=RandomInteger[{2,4}];f=b+RandomInteger[{1,2}];h=c+RandomInteger[{1,2}];myEnabled=True;A1=False; B1=False;C1=False; D1= False; state=False], ""}], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanelFrac6[a,b,c,d,e,f,h]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ b=RandomInteger[{2,3}];c=RandomInteger[{2,4}];d=RandomInteger[{2,4}];e=RandomInteger[{2,4}];f=b+RandomInteger[{1,2}];h=c+RandomInteger[{1,2}]; (* list format and string join messes up the StandardForm *) text=ToString[pn]<>". Calculate and simplify "<>ToString[ToString[1]/ToString[a], StandardForm]<>"+"<>ToString[ToString[f]/ToString[b], StandardForm]<>"+"<>ToString[ToString[h]/ToString[c], StandardForm]; text2=text; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"",B1,qClickPlus[pn];myEnabled=False;text2<>"",D1, myEnabled=False;qClickPlus[pn];text2<>"", True, text2<>""]]; answers={ToString[Simplify[(2/a)+(f/b)+(h/c)],StandardForm],ToString[Simplify[2+(1/a)+(f/b)+(h/c)],StandardForm], ToString[Simplify[(1/a)+(f/b)+(h/c)],StandardForm], ToString[Simplify[1+(1/a)+(f/b)+(h/c)],StandardForm]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] solutionPanel7[money0_,weightChicken0_,priceChicken0_,weightOrange0_,priceOrange0_,weightBeef0_,priceBeef0_, volMilk0_,priceMilk0_,unitsMilk0_,containersYogurt0_, priceYogurt0_, unitsYogurt0_, loafBread0_, priceBread0_, canPasta0_, pricePasta0_,fare0_]:= Module[{expenses,body,data,fare=fare0,money=money0,weightChicken=weightChicken0,priceChicken=priceChicken0,weightOrange=weightOrange0,priceOrange=priceOrange0,weightBeef=weightBeef0,priceBeef=priceBeef0, volMilk=volMilk0,priceMilk=priceMilk0,unitsMilk=unitsMilk0,containersYogurt=containersYogurt0, priceYogurt=priceYogurt0, unitsYogurt=unitsYogurt0, loafBread=loafBread0, priceBread=priceBread0, canPasta=canPasta0, pricePasta=pricePasta0}, expenses=(weightChicken*priceChicken)+(weightOrange*priceOrange); body={ {Text["The following table represents the grocery shopping."<>"\n"], Text["Generally multiply the price of an item by its quantity."<>"\n"], Text["If the item has a UNIT number then use "<>"\!\(\*FractionBox[\(Price\[Times]Qty\), \(Unit\)]\)"<>"\n"], Text["Add up all the expenses in the last column "<>ToString[qTrunc1[expenses]]<>"\n"], Text["Also add the fare "<>ToString[qTrunc1[expenses+fare]]<>"\n"], Text["Finally subtract the final expenses from the original money "<>ToString[qTrunc1[money-(expenses+fare)]]<>"\n"]}, {Null,Null,Null,Null,Null,Null} }; data={ {"Chicken",priceChicken,weightChicken,"NA",qTrunc1[weightChicken*priceChicken]}, {"Orange",priceOrange,weightOrange,"NA",qTrunc1[weightOrange*priceOrange]} }; Panel[Text@Grid[Prepend[data,{"Item","Price","Qty","Units","Expense"}],Background->{None,{Lighter[Yellow,.9],{White,Lighter[Blend[{Blue,Green}],.8]}}},Dividers->{{Darker[Gray,.6],{Lighter[Gray,.5]},Darker[Gray,.6]},{Darker[Gray,.6],Darker[Gray,.6],{False},Darker[Gray,.6]}},Alignment->{{Left,Left,{Left}}},ItemSize->{{10,5,5,5}},Frame->Darker[Gray,.6],ItemStyle->14,Spacings->{Automatic,.8}]] Panel[Grid[Transpose[body],Alignment->Left]] ] hintPanel7[]:=Module[{body}, body={ {Text["Generally multiply the price of an item by its quantity."<>"\n"],Text["If the item has a UNIT number then use "<>"\!\(\*FractionBox[\(Price\[Times]Qty\), \(Unit\)]\)"<>"\n"],Text["Also add the fare to expenses and finally subtract from the original money ."<>"\n"]}, {Null,Null,Null}}; Panel[Grid[Transpose[body],Alignment->Left]] ] qPaneHint7[money0_,weightChicken0_,priceChicken0_,weightOrange0_,priceOrange0_,weightBeef0_,priceBeef0_, volMilk0_,priceMilk0_,unitsMilk0_,containersYogurt0_, priceYogurt0_, unitsYogurt0_, loafBread0_, priceBread0_, canPasta0_, pricePasta0_,fare0_]:=ToString[Column[{"Expenditure = (Unit Price) \[Times] (Quantity Purchased)","Balance after expenditure = (Amount Owned) - (Total Expenditure)"}],TraditionalForm] qPanel7[pn0_,money0_,weightChicken0_,priceChicken0_,weightOrange0_,priceOrange0_,weightBeef0_,priceBeef0_, volMilk0_,priceMilk0_,unitsMilk0_,containersYogurt0_, priceYogurt0_, unitsYogurt0_, loafBread0_, priceBread0_, canPasta0_, pricePasta0_,fare0_,hint0_,diag0_]:= DynamicModule[{pn=pn0,person, fare=fare0,money=money0,weightChicken=weightChicken0,priceChicken=priceChicken0,weightOrange=weightOrange0,priceOrange=priceOrange0,weightBeef=weightBeef0,priceBeef=priceBeef0, volMilk=volMilk0,priceMilk=priceMilk0,unitsMilk=unitsMilk0,containersYogurt=containersYogurt0, priceYogurt=priceYogurt0, unitsYogurt=unitsYogurt0, loafBread=loafBread0, priceBread=priceBread0, canPasta=canPasta0, pricePasta=pricePasta0, text,hint=hint0,A1=False,B1=False,C1=False,D1=False,answer,myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, correctAnswer,incorrectAnswer1,incorrectAnswer2,incorrectAnswer3,state=False,diag=diag0,xxx,stateH=False}, qNum += 1; If[diag==False, Style[Manipulate[ xxx=xxx; person=qRandList[qNamesList]; text={ToString[pn]<>". ",person[[1]]", works in a group home as personal support worker. On Monday, ",person[[2]]," went grocery shopping with $",money," in ",person[[4]]," pocket. ",qCaps[person[[2]]]," incurred the following expenses: ",weightChicken, " pounds of chicken breasts at $",priceChicken," per pound, ", weightOrange, "kg of orange at $",priceOrange, " per kg. ", person[[1]]," spent $", fare, " on taxi fare. How much did ",person[[2]]," have after these expenses?" }; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; correctAnswer = money-((weightChicken*priceChicken)+(weightOrange*priceOrange)+fare); incorrectAnswer1 = money-((weightChicken*priceChicken)+(weightOrange*priceOrange)+fare)+2; incorrectAnswer2 = money-((weightChicken*priceChicken)+(weightOrange*priceOrange)); incorrectAnswer3 = money-((weightChicken*priceChicken)+(weightOrange*priceOrange)+fare)+1; answers={ "$"<>ToString[N[Ceiling[100*incorrectAnswer1]/100]], "$"<>ToString[N[Ceiling[100*incorrectAnswer2]/100]], "$"<>ToString[N[Ceiling[100*correctAnswer]/100]], "$"<>ToString[N[Ceiling[100*incorrectAnswer3]/100]] }; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{xxx,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];xxx=RandomReal[0.5];money=qTrunc1[RandomInteger[{200,400}]];weightChicken=qTrunc3[RandomReal[{1,5}]];priceChicken=qTrunc2[RandomReal[{2,3}]];weightOrange=RandomInteger[{1,5}];priceOrange=qTrunc1[RandomReal[{1.5,2.5}]];weightBeef=qTrunc3[RandomReal[{1,7}]];priceBeef=qTrunc1[RandomReal[{1,3}]];volMilk=RandomInteger[{1,20}];priceMilk=qTrunc1[RandomReal[{1,4}]];unitsMilk=RandomInteger[{1,4}];containersYogurt=RandomInteger[{20,60}];priceYogurt=qTrunc2[RandomReal[{3,5}]];unitsYogurt=RandomInteger[{1,12}];loafBread=RandomInteger[{3,5}];priceBread=qTrunc2[RandomReal[{2,4}]];canPasta=RandomInteger[{3,9}];pricePasta=qTrunc2[RandomReal[{2,4}]];fare=qTrunc1[RandomReal[{12,40}]];myEnabled=True;A1=False; B1=False;C1=False; D1= False], hintPanel7[]}], OpenerView[{Button["Hint",qTryAgain[pn];stateH=Not[stateH]],qPaneHint7[money,weightChicken,priceChicken,weightOrange,priceOrange,weightBeef,priceBeef, volMilk,priceMilk,unitsMilk,containersYogurt, priceYogurt, unitsYogurt, loafBread, priceBread, canPasta, pricePasta,fare]},stateH], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanel7[money,weightChicken,priceChicken,weightOrange,priceOrange,weightBeef,priceBeef, volMilk,priceMilk,unitsMilk,containersYogurt, priceYogurt, unitsYogurt, loafBread, priceBread, canPasta, pricePasta,fare]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ money=qTrunc1[RandomInteger[{200,400}]];weightChicken=qTrunc3[RandomReal[{1,5}]];priceChicken=qTrunc2[RandomReal[{2,3}]];weightOrange=RandomInteger[{1,5}];priceOrange=qTrunc1[RandomReal[{1.5,2.5}]];fare=qTrunc1[RandomReal[{12,40}]]; person=qRandList[qNamesList]; text={ToString[pn]<>". ",person[[1]]", works in a group home as personal support worker. On Monday, ",person[[2]]," went grocery shopping with $",money," in ",person[[4]]," pocket. ",qCaps[person[[2]]]," incurred the following expenses: ",weightChicken, " pounds of chicken breasts at $",priceChicken," per pound, ", weightOrange, "kg of orange at $",priceOrange, " per kg. ", person[[1]]," spent $", fare, " on taxi fare. How much did ",person[[2]]," have after these expenses?" }; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"",B1,qClickPlus[pn];myEnabled=False;text2<>"",D1, myEnabled=False;qClickPlus[pn];text2<>"", True, text2<>""]]; correctAnswer = money-((weightChicken*priceChicken)+(weightOrange*priceOrange)+fare); incorrectAnswer1 = money-((weightChicken*priceChicken)+(weightOrange*priceOrange)+fare)+2; incorrectAnswer2 = money-((weightChicken*priceChicken)+(weightOrange*priceOrange)); incorrectAnswer3 = money-((weightChicken*priceChicken)+(weightOrange*priceOrange)+fare)+1; answers={N[Ceiling[100*incorrectAnswer1]/100],N[Ceiling[100*incorrectAnswer2]/100],N[Ceiling[100*correctAnswer]/100],N[Ceiling[100*incorrectAnswer3]/100]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] qPanel7Rev[pn0_,money0_,weightChicken0_,priceChicken0_,weightOrange0_,priceOrange0_,weightBeef0_,priceBeef0_, volMilk0_,priceMilk0_,unitsMilk0_,containersYogurt0_, priceYogurt0_, unitsYogurt0_, loafBread0_, priceBread0_, canPasta0_, pricePasta0_,fare0_,hint0_]:= Module[{pn=pn0,person, fare=fare0,money=money0,weightChicken=weightChicken0,priceChicken=priceChicken0,weightOrange=weightOrange0,priceOrange=priceOrange0,weightBeef=weightBeef0,priceBeef=priceBeef0, volMilk=volMilk0,priceMilk=priceMilk0,unitsMilk=unitsMilk0,containersYogurt=containersYogurt0, priceYogurt=priceYogurt0, unitsYogurt=unitsYogurt0, loafBread=loafBread0, priceBread=priceBread0, canPasta=canPasta0, pricePasta=pricePasta0, text,hint=hint0,A1=False,B1=False,C1=False,D1=False,answer,myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, correctAnswer,incorrectAnswer1,incorrectAnswer2,incorrectAnswer3,state=False,diag=diag0}, Style[Manipulate[ person=qRandList[qNamesList]; text={ToString[pn]<>". ",person[[1]]", works in a group home as personal support worker. On Monday, ",person[[2]]," went grocery shopping with $",money," in ",person[[4]]," pocket. ",qCaps[person[[2]]]," incurred the following expenses: ",weightChicken, " pounds of chicken breasts at $",priceChicken," per pound, ", weightOrange, "kg of orange at $",priceOrange, " per kg, ", weightBeef, " kg of lean ground beef at $",priceBeef, " per kg, ",volMilk, "L skim milk (2%) at $", priceMilk, " per ", unitsMilk, "L, ", containersYogurt, " containers of yogurt at $", priceYogurt, " for ", unitsYogurt, " containers, ", loafBread, " loaves of whole bread at 1 loaf for $",priceBread, " and ", canPasta, " cans of pasta sauce at $", pricePasta, " a can. ", person[[1]]," spent $", fare, " on taxi fare. How much did ",person[[2]]," have after these expenses?" }; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; correctAnswer = money-((weightChicken*priceChicken)+(weightOrange*priceOrange)+(weightBeef*priceBeef)+(volMilk*priceMilk/unitsMilk)+(containersYogurt*priceYogurt/unitsYogurt)+(loafBread*priceBread)+(canPasta*pricePasta)+fare); incorrectAnswer1 = money-((weightChicken*priceChicken)+(weightOrange*priceOrange)+(weightBeef*priceBeef)+(volMilk*priceMilk/unitsMilk)+(containersYogurt*priceYogurt/(unitsYogurt+5))+(loafBread*priceBread)+(canPasta*pricePasta)+fare); incorrectAnswer2 = money-((weightChicken*priceChicken)+(weightOrange*priceOrange)+(weightBeef*priceBeef)+(volMilk*priceMilk/unitsMilk)+(containersYogurt*priceYogurt/unitsYogurt)+(loafBread*priceBread)+(canPasta*pricePasta)); incorrectAnswer3 = money-((weightChicken*priceChicken)+(weightOrange*priceOrange)+(weightBeef*priceBeef)+(volMilk*priceMilk/(unitsMilk+5))+(containersYogurt*priceYogurt/unitsYogurt)+(loafBread*priceBread)+(canPasta*pricePasta)+fare); answers={N[Ceiling[100*incorrectAnswer1]/100],N[Ceiling[100*incorrectAnswer2]/100],N[Ceiling[100*correctAnswer]/100],N[Ceiling[100*incorrectAnswer3]/100]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{money,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];money=qTrunc1[RandomInteger[{200,400}]];weightChicken=qTrunc3[RandomReal[{1,5}]];priceChicken=qTrunc2[RandomReal[{2,3}]];weightOrange=RandomInteger[{1,5}];priceOrange=qTrunc1[RandomReal[{1.5,2.5}]];weightBeef=qTrunc3[RandomReal[{1,7}]];priceBeef=qTrunc1[RandomReal[{1,3}]];volMilk=RandomInteger[{1,20}];priceMilk=qTrunc1[RandomReal[{1,4}]];unitsMilk=RandomInteger[{1,4}];containersYogurt=RandomInteger[{20,60}];priceYogurt=qTrunc2[RandomReal[{3,5}]];unitsYogurt=RandomInteger[{1,12}];loafBread=RandomInteger[{3,5}];priceBread=qTrunc2[RandomReal[{2,4}]];canPasta=RandomInteger[{3,9}];pricePasta=qTrunc2[RandomReal[{2,4}]];fare=qTrunc2[RandomReal[{12,40}]];myEnabled=True;A1=False; B1=False;C1=False; D1= False], hintPanel7[]}], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanel7[money,weightChicken,priceChicken,weightOrange,priceOrange,weightBeef,priceBeef, volMilk,priceMilk,unitsMilk,containersYogurt, priceYogurt, unitsYogurt, loafBread, priceBread, canPasta, pricePasta,fare]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] qPanel7Diag[pn0_,money0_,weightChicken0_,priceChicken0_,weightOrange0_,priceOrange0_,weightBeef0_,priceBeef0_, volMilk0_,priceMilk0_,unitsMilk0_,containersYogurt0_, priceYogurt0_, unitsYogurt0_, loafBread0_, priceBread0_, canPasta0_, pricePasta0_,fare0_,hint0_]:= Module[{pn=pn0,person, fare=fare0,money=money0,weightChicken=weightChicken0,priceChicken=priceChicken0,weightOrange=weightOrange0,priceOrange=priceOrange0,weightBeef=weightBeef0,priceBeef=priceBeef0, volMilk=volMilk0,priceMilk=priceMilk0,unitsMilk=unitsMilk0,containersYogurt=containersYogurt0, priceYogurt=priceYogurt0, unitsYogurt=unitsYogurt0, loafBread=loafBread0, priceBread=priceBread0, canPasta=canPasta0, pricePasta=pricePasta0, text,hint=hint0,A1=False,B1=False,C1=False,D1=False,answer,myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, correctAnswer,incorrectAnswer1,incorrectAnswer2,incorrectAnswer3,state=False,diag=diag0}, Style[Manipulate[ person=qRandList[qNamesList]; text={ToString[pn]<>". ",person[[1]]", works in a group home as personal support worker. On Monday, ",person[[2]]," went grocery shopping with $",money," in ",person[[4]]," pocket. ",qCaps[person[[2]]]," incurred the following expenses: ",weightChicken, " pounds of chicken breasts at $",priceChicken," per pound, ", weightOrange, "kg of orange at $",priceOrange, " per kg, ", weightBeef, " kg of lean ground beef at $",priceBeef, " per kg, ",volMilk, "L skim milk (2%) at $", priceMilk, " per ", unitsMilk, "L, ", containersYogurt, " containers of yogurt at $", priceYogurt, " for ", unitsYogurt, " containers, ", loafBread, " loaves of whole bread at 1 loaf for $",priceBread, " and ", canPasta, " cans of pasta sauce at $", pricePasta, " a can. ", person[[1]]," spent $", fare, " on taxi fare. How much did ",person[[2]]," have after these expenses?" }; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; correctAnswer = money-((weightChicken*priceChicken)+(weightOrange*priceOrange)+(weightBeef*priceBeef)+(volMilk*priceMilk/unitsMilk)+(containersYogurt*priceYogurt/unitsYogurt)+(loafBread*priceBread)+(canPasta*pricePasta)+fare); incorrectAnswer1 = money-((weightChicken*priceChicken)+(weightOrange*priceOrange)+(weightBeef*priceBeef)+(volMilk*priceMilk/unitsMilk)+(containersYogurt*priceYogurt/(unitsYogurt+5))+(loafBread*priceBread)+(canPasta*pricePasta)+fare); incorrectAnswer2 = money-((weightChicken*priceChicken)+(weightOrange*priceOrange)+(weightBeef*priceBeef)+(volMilk*priceMilk/unitsMilk)+(containersYogurt*priceYogurt/unitsYogurt)+(loafBread*priceBread)+(canPasta*pricePasta)); incorrectAnswer3 = money-((weightChicken*priceChicken)+(weightOrange*priceOrange)+(weightBeef*priceBeef)+(volMilk*priceMilk/(unitsMilk+5))+(containersYogurt*priceYogurt/unitsYogurt)+(loafBread*priceBread)+(canPasta*pricePasta)+fare); answers={N[Ceiling[100*incorrectAnswer1]/100],N[Ceiling[100*incorrectAnswer2]/100],N[Ceiling[100*correctAnswer]/100],N[Ceiling[100*incorrectAnswer3]/100]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] solutionPanel8[b0_,c0_]:=Module[{b=b0,c=c0,body}, body={{ "Take the temperature at the later date and subtract it from temperate from earlier date:\n", "Earlier Temperature = "<>ToString[b]<>"\n", "Later Temperature = "<>ToString[c]<>"\n", "Temperature Change = "<>"("<>ToString[c]<>")"<>"-"<>"("<>ToString[b]<>") = "<>ToString[c-b] }, {Null,Null,Null,Null}}; Panel[Grid[Transpose[body]]] ] qPaneHint8[b_,c_]:="Final Temperature change = (Fianl Temperature) - (Initial Temperature)" qPanel8[pn0_,b0_, c0_,diag0_]:= DynamicModule[{pn=pn0,text,person, A1=False,B1=False,C1=False,D1=False,answer,b=b0,c=c0, myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, state=False, diag=diag0,xxx,stateH=False }, qNum += 1; If[diag==False, Style[Manipulate[ xxx=xxx; person=qRandList[qNamesList]; text={ToString[pn]<>". The temperature on an airplane was "<>ToString[b,TraditionalForm]<>"\[InvisiblePrefixScriptBase]C. When the plane landed in Sudbury, the temperature was ", c,"\[InvisiblePrefixScriptBase]C. What change in temperature did ",person[[1]]," experience as ",person[[2]]," exited from the plane directly onto the tarmac?" }; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={ToString[b-c-1]<>"\!\(\*SuperscriptBox[\(\[InvisiblePrefixScriptBase]\), \(\[EmptySmallCircle]\)]\)C",ToString[-c+b]<>"\!\(\*SuperscriptBox[\(\[InvisiblePrefixScriptBase]\), \(\[EmptySmallCircle]\)]\)C",ToString[c-b]<>"\!\(\*SuperscriptBox[\(\[InvisiblePrefixScriptBase]\), \(\[EmptySmallCircle]\)]\)C",ToString[c-b-1]<>"\!\(\*SuperscriptBox[\(\[InvisiblePrefixScriptBase]\), \(\[EmptySmallCircle]\)]\)C"}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{xxx,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];xxx=RandomReal[0.5];b=RandomInteger[{-10,30}];c=RandomInteger[{-10,30}];myEnabled=True;A1=False; B1=False;C1=False; D1= False], ""}], OpenerView[{Button["Hint",qTryAgain[pn];stateH=Not[stateH]],qPaneHint8[b,c]},stateH], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanel8[b,c]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ b=RandomInteger[{-10,30}];c=RandomInteger[{-10,30}]; person=qRandList[qNamesList]; text={ToString[pn]<>". The temperature on an airplane was ", ToString[ToString[b]^"\[SmallCircle]",TraditionalForm],"\[InvisiblePrefixScriptBase]C. When the plane landed in Sudbury, the temperature was ", c,"\[InvisiblePrefixScriptBase]C. What change in temperature did ",person[[1]]," experience as ",person[[2]]," exited from the plane directly onto the tarmac?" }; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"",B1,qClickPlus[pn];myEnabled=False;text2<>"",D1, myEnabled=False;qClickPlus[pn];text2<>"", True, text2<>""]]; answers={ToString[b-c-1]<>"\!\(\*SuperscriptBox[\(\[InvisiblePrefixScriptBase]\), \(\[EmptySmallCircle]\)]\)C",ToString[-c+b]<>"\!\(\*SuperscriptBox[\(\[InvisiblePrefixScriptBase]\), \(\[EmptySmallCircle]\)]\)C",ToString[c-b]<>"\!\(\*SuperscriptBox[\(\[InvisiblePrefixScriptBase]\), \(\[EmptySmallCircle]\)]\)C",ToString[c-b-1]<>"\!\(\*SuperscriptBox[\(\[InvisiblePrefixScriptBase]\), \(\[EmptySmallCircle]\)]\)C"}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] solutionPanel18[b0_,c0_]:=Module[{b=b0,c=c0,body}, body={{ ToString[ToString[ToString[-b^2,StandardForm]^2, StandardForm]<>"-"<>ToString[Sqrt[(b^2)-(c)*(ToString[b]^2-(c))],StandardForm] ,StandardForm]<>ToString["+(-"<>ToString[b^2]<>")"^2, StandardForm], "\n= "<>ToString[ToString[ToString[-b^2,StandardForm]^2, StandardForm]<>"-"<>ToString[Sqrt[(b^2)+ToString[-(c)*(b^2-(c))]],StandardForm] ,StandardForm]<>ToString["+(-"<>ToString[b^2]<>")"^2, StandardForm], "\n= "<>ToString[ToString[ToString[-b^2,StandardForm]^2, StandardForm]<>"-"<>ToString[Sqrt[(b^2)+-(c)*(b^2-(c))]] ,StandardForm]<>ToString["+(-"<>ToString[b^2]<>")"^2, StandardForm], "\n= "<>ToString[-Sqrt[(b^2)+-(c)*(b^2-(c))]] }, {Null,Null,Null,Null}}; Panel[Grid[Transpose[body]]] ] panel18Helper[]:=Module[{b,c,list}, list={}; Table[If[IntegerQ[Sqrt[b^2-c*((b^2)-c)]] == True, AppendTo[list,{b,c}]], {b, 2, 10},{c, 2, 10}]; list ] qPaneHint18[b_,c_]:="Think \"BEDMAS\"" qPanel18[pn0_,b0_,c0_,diag0_]:= DynamicModule[{pn=pn0,text,person, A1=False,B1=False,C1=False,D1=False,answer,b=b0,c=c0,myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, state=False, diag=diag0,xxx ,list,n,i,stateH=False}, qNum += 1; list=panel18Helper[]; n=Length[list]; If[diag==False, Style[Manipulate[ xxx=xxx; text={ToString[pn]<>". Find the answer to "<>ToString[ToString[ToString[-b^2,StandardForm]^2, StandardForm]<>ToString["+(-"<>ToString[b^2]<>")"^2, StandardForm]<>"-"<>ToString[Sqrt[(b^2)-(c)*(ToString[b]^2-(c))],StandardForm] ,StandardForm]}; text2=text; (* do not do stringjoin or the radical goes bad *) answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={ToString[-Sqrt[b^2-c*((b^2)-c)]+2],ToString[-Sqrt[b^2-c*((b^2)-c)]+1],ToString[-Sqrt[b^2-c*((b^2)-c)]],ToString[-Sqrt[b^2-c*((b^2)-c)]+3]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{xxx,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];xxx=RandomReal[0.5];i=RandomInteger[{1,n}];b=list[[i]][[1]];c=list[[i]][[2]];myEnabled=True;A1=False; B1=False;C1=False; D1= False], ""}], OpenerView[{Button["Hint",qTryAgain[pn];stateH=Not[stateH]],qPaneHint18[b,c]},stateH], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanel18[b,c]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ i=RandomInteger[{1,n}];b=list[[i]][[1]];c=list[[i]][[2]]; text={ToString[pn]<>". Find the answer to "<>ToString[ToString[ToString[-b^2,StandardForm]^2, StandardForm]<>ToString["+(-"<>ToString[b^2]<>")"^2, StandardForm]<>"-"<>ToString[Sqrt[(b^2)-(c)*(ToString[b]^2-(c))],StandardForm] ,StandardForm]}; text2=text; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"",B1,qClickPlus[pn];myEnabled=False;text2<>"",D1, myEnabled=False;qClickPlus[pn];text2<>"", True, text2<>""]]; answers={ToString[-Sqrt[b^2-c*((b^2)-c)]+2],ToString[-Sqrt[b^2-c*((b^2)-c)]+1],ToString[-Sqrt[b^2-c*((b^2)-c)]],ToString[-Sqrt[b^2-c*((b^2)-c)]+3]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[j]]]], {j, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[j]]]], {j, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] qPanel8Diag[pn0_,b0_, c0_]:= Module[{pn=pn0,text,person, A1=False,B1=False,C1=False,D1=False,answer,b=b0,c=c0, myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, state=False, diag=diag0 }, Style[Manipulate[ person=qRandList[qNamesList]; text={ToString[pn]<>". The temperature on an airplane was ", b,"\[InvisiblePrefixScriptBase]C. When the plane landed in Sudbury, the temperature was ", c,"\[InvisiblePrefixScriptBase]C. What change in temperature did ",person[[1]]," experience as ",person[[2]]," exited from the plane directly onto the tarmac?" }; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={ToString[b-c-1]<>"\!\(\*SuperscriptBox[\(\[InvisiblePrefixScriptBase]\), \(\[EmptySmallCircle]\)]\)C",ToString[-c+b]<>"\!\(\*SuperscriptBox[\(\[InvisiblePrefixScriptBase]\), \(\[EmptySmallCircle]\)]\)C",ToString[c-b]<>"\!\(\*SuperscriptBox[\(\[InvisiblePrefixScriptBase]\), \(\[EmptySmallCircle]\)]\)C",ToString[c-b-1]<>"\!\(\*SuperscriptBox[\(\[InvisiblePrefixScriptBase]\), \(\[EmptySmallCircle]\)]\)C"}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] qPanel8Rev[pn0_,b0_, c0_]:= Module[{pn=pn0,text,person, A1=False,B1=False,C1=False,D1=False,answer,b=b0,c=c0, myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, state=False, diag=diag0 }, Style[Manipulate[ person=qRandList[qNamesList]; text={ToString[pn]<>". The temperature on an airplane was ", b,"\[InvisiblePrefixScriptBase]C. When the plane landed in Sudbury, the temperature was ", c,"\[InvisiblePrefixScriptBase]C. What change in temperature did ",person[[1]]," experience as ",person[[2]]," exited from the plane directly onto the tarmac?" }; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={ToString[b-c-1]<>"\!\(\*SuperscriptBox[\(\[InvisiblePrefixScriptBase]\), \(\[EmptySmallCircle]\)]\)C",ToString[-c+b]<>"\!\(\*SuperscriptBox[\(\[InvisiblePrefixScriptBase]\), \(\[EmptySmallCircle]\)]\)C",ToString[c-b]<>"\!\(\*SuperscriptBox[\(\[InvisiblePrefixScriptBase]\), \(\[EmptySmallCircle]\)]\)C",ToString[c-b-1]<>"\!\(\*SuperscriptBox[\(\[InvisiblePrefixScriptBase]\), \(\[EmptySmallCircle]\)]\)C"}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{b,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];b=RandomInteger[{-10,30}];c=RandomInteger[{-10,30}];myEnabled=True;A1=False; B1=False;C1=False; D1= False], ""}], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanel8[b,c]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] solutionPanel9[b0_,c0_]:=DynamicModule[{b=b0,c=c0,body}, body={{ "Multiply the Raise by Salary amount:\n", ToString[qTrunc1[c]/100]<>"\[Times]"<>ToString[b]<>" = "<>ToString[qTrunc5[c*b/100]]"\n" }, {Null,Null}}; Panel[Grid[Transpose[body]]] ] qPaneHint9[b_,c_]:="Increase in Salary = (Currenty Wage) \[Times] (% increase in decimal)" qPanel9[pn0_,b0_, c0_,diag0_]:= DynamicModule[{pn=pn0,text,person,variations,A1=False,B1=False,C1=False,D1=False,answer,b=b0,c=c0,a, myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, state=False, diag=diag0,stateH=False }, qNum +=1; If[diag==False, Style[Manipulate[ a=a; (* kludge *) person=qRandList[qNamesList]; variations={{ToString[pn]<>". ",person[[1]],"'s annual salary is $", Ceiling[b],"\[InvisiblePrefixScriptBase]. ",qCaps[person[[4]]] ," raise for year is ", qTrunc1[c],"\[InvisiblePrefixScriptBase]%. What is the annual increase in salary?" }, {ToString[pn]<>". ",person[[1]],"'s yearly wage is $", Ceiling[b],"\[InvisiblePrefixScriptBase]. ",qCaps[person[[4]]] ," pay increase for year is ", qTrunc1[c],"\[InvisiblePrefixScriptBase]%. What is the annual increase in salary?" } }; text=qRandList[variations]; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={"$"<>ToString[qTrunc5[c*b/10]],"$"<>ToString[qTrunc5[c*b/5]],"$"<>ToString[qTrunc5[qTrunc1[c]*Ceiling[b]/100]],"$"<>ToString[qTrunc5[c*b/20]]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{a,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];a=RandomReal[0.5];b=RandomInteger[{18000,100000}];c=RandomReal[{1.0,12.0}];myEnabled=True;A1=False; B1=False;C1=False; D1= False], ""}], OpenerView[{Button["Hint",qTryAgain[pn];stateH=Not[stateH]],qPaneHint9[b,c]},stateH], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanel9[b,c]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ person=qRandList[qNamesList]; b=1000*RandomInteger[{25,54}]; c=RandomReal[{5.0,12.0}]; variations={{ToString[pn]<>". ",person[[1]],"'s annual salary is $", Ceiling[b],"\[InvisiblePrefixScriptBase]. ",qCaps[person[[4]]] ," raise for year is ", qTrunc1[c],"\[InvisiblePrefixScriptBase]%. What is the annual increase in salary?" }, {ToString[pn]<>". ",person[[1]],"'s yearly wage is $", Ceiling[b],"\[InvisiblePrefixScriptBase]. ",qCaps[person[[4]]] ," pay increase for year is ", qTrunc1[c],"\[InvisiblePrefixScriptBase]%. \[InvisiblePrefixScriptBase] What is the annual increase in salary?" } }; text=qRandList[variations]; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"",B1,qClickPlus[pn];myEnabled=False;text2<>"",D1, myEnabled=False;qClickPlus[pn];text2<>"", True, text2<>""]]; answers={"$"<>ToString[qTrunc5[c*b/10]],"$"<>ToString[qTrunc5[c*b/5]],"$"<>ToString[qTrunc5[qTrunc1[c]*Ceiling[b]/100]],"$"<>ToString[qTrunc5[c*b/20]]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] solutionPanel10[b0_,c0_]:=Module[{b=b0,c=c0,body}, body={{ "It should occur to you immediately you read the question that the vessel is full when it is 100%. This implies that a full-seating capacity occurs when it is 100% full Let y represent the full seating capacity of the ship. Then:\n", ToString[c]<>"% of y = "<>ToString[b]<>"\n", "Divide each side by "<>ToString[qTrunc1[c/100]]<>": \n", ToString[ToString[qTrunc1[c/100]]<>"\[Times]"<>"y"/ToString[qTrunc1[c/100]], StandardForm]<>" = "<>ToString[ToString[b]/ToString[qTrunc1[c/100]],StandardForm]<>"\n", "Solve for y: \n", "y = "<>ToString[ToString[b]/ToString[qTrunc1[c/100]],StandardForm]<>" = "<>ToString[Ceiling[100*b/c]] }, {Null,Null,Null,Null,Null,Null}}; Panel[Grid[Transpose[body]]] ] qPaneHint10[b_,c_]:="\!\(\*FractionBox[\(#\), \(100\)]\) = \!\(\*FractionBox[\(part\), \(whole\)]\)" qPanel10[pn0_,b0_, c0_, diag0_]:= DynamicModule[{pn=pn0,text,person,A1=False,B1=False,C1=False,D1=False,answer,a,b=b0,c=c0, myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, state=False, diag=diag0,stateH=False }, qNum += 1; If[diag == False, Style[Manipulate[ a=a; variations = {{ToString[pn]<>". ship was ", c,"\[InvisiblePrefixScriptBase]% full when it had ", b,"\[InvisiblePrefixScriptBase] passengers. What is the full seating capacity of the ship?" }, {ToString[pn]<>". A cruise ship was ", c,"\[InvisiblePrefixScriptBase]% full when it had ", b,"\[InvisiblePrefixScriptBase] passengers. What is the full seating capacity of the ship?" }, {ToString[pn]<>". A naval vessel was ", c,"\[InvisiblePrefixScriptBase]% full when it had ", b,"\[InvisiblePrefixScriptBase] passengers. What is the full seating capacity of the ship?" } }; text=qRandList[variations]; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={ToString[Ceiling[20*b/c]],ToString[Ceiling[50*b/c]],ToString[Ceiling[100*b/c]],ToString[Ceiling[10*b/c]]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{a,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];a=RandomReal[0.5];b=RandomInteger[{100,500}];c=RandomInteger[{5,95}];myEnabled=True;A1=False; B1=False;C1=False; D1= False], ""}], OpenerView[{Button["Hint",qTryAgain[pn];stateH=Not[stateH]],qPaneHint10[b,Ceiling[c]]},stateH], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanel10[b,Ceiling[c]]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ a=RandomReal[0.5];b=RandomInteger[{100,500}];c=RandomInteger[{5,95}]; variations = {{ToString[pn]<>". An airplane was ", c,"\[InvisiblePrefixScriptBase]% full when it had ", b,"\[InvisiblePrefixScriptBase] passengers. What is the full seating capacity of the ship?" }, {ToString[pn]<>". A cruise ship was ", c,"\[InvisiblePrefixScriptBase]% full when it had ",b,"\[InvisiblePrefixScriptBase] passengers. What is the full seating capacity of the ship?" }, {ToString[pn]<>". A naval vessel was ", c,"\[InvisiblePrefixScriptBase]% full when it had ", b,"\[InvisiblePrefixScriptBase] passengers. What is the full seating capacity of the ship?" } }; text=qRandList[variations]; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"",B1,qClickPlus[pn];myEnabled=False;text2<>"",D1, myEnabled=False;qClickPlus[pn];text2<>"", True, text2<>""]]; answers={ToString[Ceiling[20*b/c]],ToString[Ceiling[50*b/c]],ToString[Ceiling[100*b/c]],ToString[Ceiling[10*b/c]]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] solutionPanel11[b0_,c0_]:=Module[{b=b0,c=c0,body}, body={{ "Calculate the change as follows:\n", ToString["("<>ToString[qTrunc1[c]]<>"-"<>ToString[qTrunc1[b]]<>")"<>"\[Times] 100"/ToString[qTrunc1[b]],StandardForm]<>" = "<>ToString[100*(c-b)/b]<>"\[TildeTilde]"<>ToString[qTrunc5[100*(c-b)/b]]<>"%" }, {Null,Null}}; Panel[Grid[Transpose[body]]] ] qPaneHint11[b_,c_]:="Percent increase =\!\(\*FractionBox[\(\((final\\\ amount)\)\\\ - \\\ \((original\\\ amount)\)\), \((original\\\ amount)\)]\) \[Times] 100" qPanel11[pn0_,b0_, c0_, diag0_]:= DynamicModule[{pn=pn0,text,person,variations,A1=False,B1=False,C1=False,D1=False,answer,a,b=b0,c=c0, myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, state=False, diag=diag0,stateH=False }, qNum += 1; If[diag==False, Style[Manipulate[ a=a; person=qRandList[qNamesList]; variations={{ToString[pn]<>". ",person[[1]],"\[CloseCurlyQuote]s hourly wage was increased from $", qTrunc1[b],"/h to $", qTrunc1[c],"/h.\[InvisiblePrefixScriptBase] What is the percentage Increase in ", person[[4]], " wage rate?" }, {ToString[pn]<>". ",person[[1]],"\[CloseCurlyQuote]s hourly rate was increased from $", qTrunc1[b],"/h to $", qTrunc1[c],"/h.\[InvisiblePrefixScriptBase] Calculate the percentage Increase in ", person[[4]], " hourly rate?" } }; text=qRandList[variations]; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={ToString[qTrunc5[50*(c-b)/b]]<>"%",ToString[qTrunc5[200*(c-b)/b]]<>"%",ToString[qTrunc5[100*(qTrunc1[c]-qTrunc1[b])/qTrunc1[b]]]<>"%",ToString[qTrunc5[130*(c-b)/b]]<>"%"}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{a,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];a=RandomReal[0.5];b=RandomReal[{10.0,50.0}];c=b+b*RandomReal[{0.10,0.5}];myEnabled=True;A1=False; B1=False;C1=False; D1= False], ""}], OpenerView[{Button["Hint",qTryAgain[pn];stateH=Not[stateH]],qPaneHint11[b,c]},stateH], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanel11[b,c]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ a=RandomReal[0.5];b=RandomReal[{10.0,50.0}];c=b+b*RandomReal[{0.10,0.5}]; person=qRandList[qNamesList]; variations={{ToString[pn]<>". ",person[[1]],"\[CloseCurlyQuote]s hourly wage was increased from $", qTrunc1[b],"/h to $", qTrunc1[c],"/h.\[InvisiblePrefixScriptBase] What is the percentage Increase in ", person[[4]], " wage rate?" }, {ToString[pn]<>". ",person[[1]],"\[CloseCurlyQuote]s hourly rate was increased from $", qTrunc1[b],"/h to $", qTrunc1[c],"/h.\[InvisiblePrefixScriptBase] Calculate the percentage Increase in ", person[[4]], " hourly rate?" } }; text=qRandList[variations]; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"",B1,qClickPlus[pn];myEnabled=False;text2<>"",D1, myEnabled=False;qClickPlus[pn];text2<>"", True, text2<>""]]; answers={ToString[qTrunc5[50*(c-b)/b]]<>"%",ToString[qTrunc5[200*(c-b)/b]]<>"%",ToString[qTrunc5[100*(qTrunc1[c]-qTrunc1[b])/qTrunc1[b]]]<>"%",ToString[qTrunc5[130*(c-b)/b]]<>"%"}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] solutionPanel12[b0_,c0_]:=Module[{b=b0,c=c0,body}, body={{ "Calculate the increased value as follows:\n", ToString[ToString[qTrunc1[b]]<>"+"<>ToString[qTrunc1[b]]<>"\[Times]"<>ToString[qTrunc1[c/100]],StandardForm]<>" = "<>ToString[qTrunc5[(1+(c/100))*b]] }, {Null,Null}}; Panel[Grid[Transpose[body]]] ] qPaneHint12[b_,c_]:=ToString[Column[{"Number Increase = (Number) \[Times] (% increase in decimal)","","Total after increase = (Original Amount) + (Increase)"}],TraditionalForm] qPanel12[pn0_,b0_, c0_,diag0_]:= DynamicModule[{pn=pn0,text,A1=False,B1=False,C1=False,D1=False,answer,a,b=b0,c=c0, myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, state=False,diag=diag0,stateH=False }, qNum +=1; If[diag==False, Style[Manipulate[ a=a; variations={{ToString[pn]<>". What is the number when ", qTrunc1[b]," is increased by ", qTrunc1[c],"% ?" }, {ToString[pn]<>". Increase ", qTrunc1[b]," by ", qTrunc1[c],"% , what is the outcome?" } }; text=qRandList[variations]; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={ToString[qTrunc5[(1+(c/70))*b]],ToString[qTrunc5[(1+(c/20))*b]],ToString[qTrunc5[(1+(qTrunc1[c]/100))*qTrunc1[b]]],ToString[qTrunc5[(1+(c/120))*b]]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{a,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];a=RandomReal[0.5];b=RandomInteger[{10,200}];c=RandomInteger[{10,100}];myEnabled=True;A1=False; B1=False;C1=False; D1= False], ""}], OpenerView[{Button["Hint",qTryAgain[pn];stateH=Not[stateH]],qPaneHint12[b,c]},stateH], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanel12[b,c]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ a=RandomReal[0.5];b=RandomInteger[{10,200}];c=RandomInteger[{10,100}]; variations={{ToString[pn]<>". What is the number when ", qTrunc1[b]," is increased by ", qTrunc1[c],"% ?" }, {ToString[pn]<>". Increase ", qTrunc1[b]," by ", qTrunc1[c],"% , what is the outcome?" } }; text=qRandList[variations]; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"",B1,qClickPlus[pn];myEnabled=False;text2<>"",D1, myEnabled=False;qClickPlus[pn];text2<>"", True, text2<>""]]; answers={ToString[qTrunc5[(1+(c/70))*b]],ToString[qTrunc5[(1+(c/20))*b]],ToString[qTrunc5[(1+(qTrunc1[c]/100))*qTrunc1[b]]],ToString[qTrunc5[(1+(c/120))*b]]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] solutionPanel13[b0_,c0_]:=Module[{b=b0,c=c0,body}, body={{ "Calculate the decreased value as follows:\n", ToString[ToString[qTrunc1[b]]<>"-"<>ToString[qTrunc1[b]]<>"\[Times]"<>ToString[qTrunc1[c/100]],StandardForm]<>" = "<>ToString[qTrunc5[(1-(c/100))*b]] }, {Null,Null}}; Panel[Grid[Transpose[body]]] ] qPaneHint13[b_,c_]:=ToString[Column[{"Amount decrease = (Original Amount) \[Times] (% decrease in decimal)","","Total Amount after Decrease = (Original Amount) - (Amount Decrease)"}],TraditionalForm] qPanel13[pn0_,b0_, c0_,diag0_]:= DynamicModule[{pn=pn0,text,variations,A1=False,B1=False,C1=False,D1=False,answer,a,b=b0,c=c0, myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, state=False,diag=diag0,stateH=False }, qNum += 1; If[diag==False, Style[Manipulate[ a=a; variations={{ToString[pn]<>". What is the amount due when a debt of $", qTrunc1[b]," is reduced by ", qTrunc1[c],"% ?" }, {ToString[pn]<>". A debt valued at $", qTrunc1[b]," is reduced by ", qTrunc1[c],"% , how much is owed ?" } }; text=qRandList[variations]; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={"$"<>ToString[qTrunc5[1.5*(1-(c/100))*b]],"$"<>ToString[qTrunc5[0.7*(1-(c/100))*b]],"$"<>ToString[qTrunc5[(1-(qTrunc1[c]/100))*qTrunc1[b]]],"$"<>ToString[2*qTrunc5[(1-(c/100))*b]]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{a,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];a=RandomReal[0.5];b=RandomInteger[{100,500}];c=RandomInteger[{10,60}];myEnabled=True;A1=False; B1=False;C1=False; D1= False], ""}], OpenerView[{Button["Hint",qTryAgain[pn];stateH=Not[stateH]],qPaneHint13[b,c]},stateH], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanel13[b,c]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ a=RandomReal[0.5];b=RandomInteger[{100,500}];c=RandomInteger[{10,60}]; variations={{ToString[pn]<>". What is the amount due when a debt of $", qTrunc1[b]," is reduced by ", qTrunc1[c],"% ?" }, {ToString[pn]<>". A debt valued at $", qTrunc1[b]," is reduced by ", qTrunc1[c],"% , how much is owed ?" } }; text=qRandList[variations]; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"",B1,qClickPlus[pn];myEnabled=False;text2<>"",D1, myEnabled=False;qClickPlus[pn];text2<>"", True, text2<>""]]; answers={"$"<>ToString[qTrunc5[1.5*(1-(c/100))*b]],"$"<>ToString[qTrunc5[0.7*(1-(c/100))*b]],"$"<>ToString[qTrunc5[(1-(qTrunc1[c]/100))*qTrunc1[b]]],"$"<>ToString[2*qTrunc5[(1-(c/100))*b]]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] solutionPanel14[b0_,c0_]:=Module[{b=b0,c=c0,body}, body={{ "Calculate the Discount Rate as follows:\n", ToString[ToString[ ("("<>ToString[qTrunc1[c]]<>"-"<>ToString[qTrunc1[b]]<>")" )/ToString[qTrunc1[b]] ,TraditionalForm]<>"\[Times]"<>ToString[100, StandardForm]<>"%",StandardForm]<>" = "<>ToString[qTrunc5[100*(c-b)/b]]<>"%" }, {Null,Null}}; Panel[Grid[Transpose[body]]] ] qPaneHint14[b_,c_]:="Percent increase =\!\(\*FractionBox[\(\((final\\\ amount)\)\\\ - \\\ \((original\\\ amount)\)\), \((original\\\ amount)\)]\) \[Times] 100" qPanel14[pn0_,b0_, c0_,diag0_]:= DynamicModule[{pn=pn0,text,variations,A1=False,B1=False,C1=False,D1=False,answer,a,b=b0,c=c0, myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, state=False,diag=diag0,stateH=False }, qNum += 1; If[diag==False, Style[Manipulate[ a=a; variations ={{ToString[pn]<>". A portable CD player costing $", qTrunc1[b]," is on sale for $", qTrunc1[c],". What is the rate of discount ?" }, {ToString[pn]<>". A $", qTrunc1[b]," DVD player is on sale for $", qTrunc1[c],". What is the rate of discount ?" }, {ToString[pn]<>". A smartphone priced at $", qTrunc1[b]," is on sale for $", qTrunc1[c],". What is the discount rate ?" } }; text=qRandList[variations]; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={ "-"<>ToString[qTrunc5[50*(b-c)/b]]<>"%", "-"<>ToString[qTrunc5[130*(b-c)/b]]<>"%", "-"<>ToString[qTrunc5[100*(qTrunc1[b]-qTrunc1[c])/qTrunc1[b]]]<>"%", "-"<>ToString[qTrunc5[20*(b-c)/b]]<>"%"}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{a,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];a=RandomReal[0.5];b=RandomInteger[{100,500}];c=b-b*RandomReal[{0.10,0.60}];myEnabled=True;A1=False; B1=False;C1=False; D1= False], ""}], OpenerView[{Button["Hint",qTryAgain[pn];stateH=Not[stateH]],qPaneHint14[b,c]},stateH], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanel14[b,c]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ a=RandomReal[0.5];b=RandomInteger[{100,500}];c=b-b*RandomReal[{0.10,0.60}]; variations ={{ToString[pn]<>". A portable CD player costing $", qTrunc1[b]," is on sale for $", qTrunc1[c],". What is the rate of discount ?" }, {ToString[pn]<>". A $", qTrunc1[b]," DVD player is on sale for $", qTrunc1[c],". What is the rate of discount ?" }, {ToString[pn]<>". A smartphone priced at $", qTrunc1[b]," is on sale for $", qTrunc1[c],". What is the discount rate ?" } }; text=qRandList[variations]; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"",B1,qClickPlus[pn];myEnabled=False;text2<>"",D1, myEnabled=False;qClickPlus[pn];text2<>"", True, text2<>""]]; answers={ToString[qTrunc5[50*(b-c)/b]]<>"%",ToString[qTrunc5[130*(b-c)/b]]<>"%",ToString[qTrunc5[100*(qTrunc1[b]-qTrunc1[c])/qTrunc1[b]]]<>"%",ToString[qTrunc5[20*(b-c)/b]]<>"%"}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] solutionPanel15[b0_,c0_]:=Module[{b=b0,c=c0,body}, body={{ "Calculate the money saved as follows:\n", ToString[qTrunc1[c/100]]<>"\[Times]"<>ToString[qTrunc1[b]]<>" = "<>"$"<>ToString[qTrunc5[b*c/100]] }, {Null,Null}}; Panel[Grid[Transpose[body]]] ] qPaneHint15[b_,c_]:="Discount = Original Amount \[Times] % Discount" qPanel15[pn0_,b0_, c0_,diag0_]:= DynamicModule[{pn=pn0,text,person, variations,A1=False,B1=False,C1=False,D1=False,answer,a, b=b0,c=c0, myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, state=False,diag=diag0,stateH=False }, qNum +=1; If[diag==False, Style[Manipulate[ a=a; person=qRandList[qNamesList]; variations={{ToString[pn]<>". ",person[[1]]," wants to buy a new carpet for ",person[[4]]," house. The new carpet costs $", qTrunc1[b]," . One day ", person[[2]], " saw the carpet being offered for ", qTrunc1[c],"% off the purchase price. How much money does ",person[[2]]," save by buying the carpet?" }, {ToString[pn]<>". ",person[[1]]," decides to buy a new stereo for ",person[[4]]," car. The new stereo costs $", qTrunc1[b]," . The other day ", person[[2]], " saw the stereo being advertised for ", qTrunc1[c],"% off the shelf price. How much does ",person[[2]]," save by buying the stereo?" } }; text=qRandList[variations]; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={"$"<>ToString[qTrunc5[0.8*b*c/100]],"$"<>ToString[qTrunc5[0.5*b*c/100]],"$"<>ToString[qTrunc5[qTrunc1[b]*qTrunc1[c]/100]],"$"<>ToString[qTrunc5[0.2*b*c/100]]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{a,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];a=RandomReal[0.5];b=RandomInteger[{100,500}];c=RandomInteger[{10,60}];myEnabled=True;A1=False; B1=False;C1=False; D1= False], ""}], OpenerView[{Button["Hint",qTryAgain[pn];stateH=Not[stateH]],qPaneHint15[b,c]},stateH], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanel15[b,c]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ a=RandomReal[0.5];b=RandomInteger[{100,500}];c=RandomInteger[{10,60}]; person=qRandList[qNamesList]; variations={{ToString[pn]<>". ",person[[1]]," wants to buy a new carpet for ",person[[4]]," house. The new carpet costs $", qTrunc1[b]," . One day ", person[[2]], " saw the carpet being offered for ", qTrunc1[c],"% off the purchase price. How much money does ",person[[2]]," save by buying the carpet?" }, {ToString[pn]<>". ",person[[1]]," decides to buy a new stereo for ",person[[4]]," car. The new stereo costs $", qTrunc1[b]," . The other day ", person[[2]], " saw the stereo being advertised for ", qTrunc1[c],"% off the shelf price. How much does ",person[[2]]," save by buying the stereo?" } }; text=qRandList[variations]; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"",B1,qClickPlus[pn];myEnabled=False;text2<>"",D1, myEnabled=False;qClickPlus[pn];text2<>"", True, text2<>""]]; answers={"$"<>ToString[qTrunc5[0.8*b*c/100]],"$"<>ToString[qTrunc5[0.5*b*c/100]],"$"<>ToString[qTrunc5[qTrunc1[b]*qTrunc1[c]/100]],"$"<>ToString[qTrunc5[0.2*b*c/100]]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] solutionPanel16[b0_,c0_,d0_,e0_]:=Module[{b=b0,c=c0,d=d0,e=e0,body}, body={{ "You need to apply the discounts twice to $"<>ToString[qTrunc1[b]]<>": \n", "1. "<>"("<>ToString["1-"<>ToString[qTrunc1[c/100]],StandardForm]<>")\[Times]"<>ToString[qTrunc1[1*b]]<>" = "<>"$"<>ToString[qTrunc1[1*b*(1-(c/100))]]<>"\n", "Apply the other discount to the first discounted value:\n", "2. "<>"("<>ToString["1-"<>ToString[qTrunc1[d/100]],StandardForm]<>")\[Times]"<>ToString[qTrunc1[1*b*(1-(c/100))]]<>" = "<>"$"<>ToString[qTrunc1[1*b*(1-(c/100))*(1-(d/100))]]<>"\n", "3. Apply the number of items to the discounted value: \n", ToString[e]<>"\[Times]"<>ToString[qTrunc1[1*b*(1-(c/100))*(1-(d/100))]]<>" = $"<>ToString[qTrunc5[e*b*(1-(c/100))*(1-(d/100))]] }, {Null,Null,Null,Null,Null,Null}}; Panel[Grid[Transpose[body]]] ] qPaneHint3[b_, c_,d_,e_]:= ToString[Column[{"Find the discounted price.","","Discounted price = (Original Amount) - (Original Amount \[Times] %discount)"}],TraditionalForm] qPanel16[pn0_,b0_, c0_,d0_,e0_,diag0_]:= DynamicModule[{pn=pn0,text,variations, person, A1=False,B1=False,C1=False,D1=False,answer,a, b=b0,c=c0,d=d0, e=e0,myEnabled=True,text2,body, answers, checks,answersShuffled,checksShuffled,index,answerStudent,tryAgain=True, state=False,diag=diag0,stateH=False }, qNum +=1; If[diag==False, Style[Manipulate[ a=a; person=qRandList[qNamesList]; variations={{ToString[pn]<>". More Store Corner is having a sale event. Jeans pants regularly priced at $", qTrunc1[b]," is being reduced by ", qTrunc1[c],"% and reduced by an additional ",qTrunc1[d], "% on Saturdays only. ",person[[1]]," bought ", qTrunc1[e]," jeans on Saturday. How much does ",person[[2]],"pay for the ", qTrunc1[e], " shirts?" }, {ToString[pn]<>". GAP is having a sale. Jeans Shirts regularly priced at $", qTrunc1[b]," is being reduced by ", qTrunc1[c],"% and reduced by an additional ",qTrunc1[d], "% on Sundays only. ",person[[1]]," bought ", qTrunc1[e]," shirts on Sunday. How much does ",person[[2]],"pay for the", qTrunc1[e], " Jeans?" } }; text=qRandList[variations]; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",B1,qClickPlus[pn];myEnabled=False;text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={"$"<>ToString[qTrunc5[e*(1-(c/100))*(1-(0/100))*b]],"$"<>ToString[qTrunc5[e*(1-(0/100))*(1-(d/100))*b]],"$"<>ToString[qTrunc5[qTrunc1[e]*(1-(qTrunc1[c]/100))*(1-(qTrunc1[d]/100))*qTrunc1[b]]],"$"<>ToString[qTrunc5[1*(1-(c/100))*(1-(d/100))*b]]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{a,1,""}, (* initial value of a*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];a=RandomReal[0.5];b=RandomInteger[{100,250}];c=RandomInteger[{10,60}];d=RandomInteger[{10,60}];e=RandomInteger[{1,4}];myEnabled=True;A1=False; B1=False;C1=False; D1= False], ""}], OpenerView[{Button["Hint",qTryAgain[pn];stateH=Not[stateH]],qPaneHint3[b, c,d,e]},stateH], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPanel16[b,c,d,e]},state]},{Null,Null}}] &}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ a=RandomReal[0.5];b=RandomInteger[{100,250}];c=RandomInteger[{10,60}];d=RandomInteger[{10,60}];e=RandomInteger[{2,3}]; person=qRandList[qNamesList]; variations={{ToString[pn]<>". More Store Corner is having a sale event. Shirts regularly priced at $", qTrunc1[b]," is being reduced by ", qTrunc1[c],"% and reduced by an additional ",qTrunc1[d], "% on Saturdays only. ",person[[1]]," bought ", qTrunc1[e]," shirts on Saturday. How much does ",person[[2]]," pay for the ", qTrunc1[e], " shirts?" }, {ToString[pn]<>". GAP is having a sale. Jeans regularly priced at $", qTrunc1[b]," is being reduced by ", qTrunc1[c],"% and reduced by an additional ",qTrunc1[d], "% on Sundays only. ",person[[1]]," bought ", qTrunc1[e]," Jeans on Sunday. How much does ",person[[2]]," pay for the ",qTrunc1[e], " Jeans?" } }; text=qRandList[variations]; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"",C1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"",B1,qClickPlus[pn];myEnabled=False;text2<>"",D1, myEnabled=False;qClickPlus[pn];text2<>"", True, text2<>""]]; answers={"$"<>ToString[qTrunc5[e*(1-(c/100))*(1-(0/100))*b]],"$"<>ToString[qTrunc5[e*(1-(0/100))*(1-(d/100))*b]],"$"<>ToString[qTrunc5[qTrunc1[e]*(1-(qTrunc1[c]/100))*(1-(qTrunc1[d]/100))*qTrunc1[b]]],"$"<>ToString[qTrunc5[1*(1-(c/100))*(1-(d/100))*b]]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] qPlot1[pn0_,m0_,b0_,hint0_]:=Module[{pn=pn0,text,b=b0, m=m0, hint=hint0,x,A1,B1,C1,D1,answer ,myEnabled=True,answerStudent, text2,body,answersShuffled,checksShuffled , checks, index, answers,tryAgain=True,state=False}, Style[Manipulate[ text={ToString[pn]<>". Which one of the following lines has equation\n y = (",m,")x +(",b,")"}; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",B1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",C1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={Plot[(m^2+1)*x+(2*b+2), {x,-5,5},AxesLabel->{"x","y"}],Plot[m*x+b, {x,-5,5},AxesLabel->{"x","y"}],Plot[(m+1)*x+b+3, {x,-5,5},AxesLabel->{"x","y"}],Plot[-m*x+b-3, {x,-5,5},AxesLabel->{"x","y"}]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{b,2,""}, (* initial value of b *) {m,1,""}, Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];b=RandomInteger[{-5,5}];m=RandomInteger[{-5,5}];myEnabled=True;A1=False; B1=False;C1=False; D1= False;state=False],"use graph paper"}], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],hint[m,b]},state]},{Null,Null}}]&}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] qPlot2[pn0_,m0_,b0_,hint0_]:=Module[{pn=pn0,b=b0, m=m0, hint=hint0,x,A1,B1,C1,D1,answer ,myEnabled=True,answerStudent, text2,body,answersShuffled,checksShuffled , checks, index, answers,tryAgain=True,text}, Style[Manipulate[ text={ToString[pn]<>". Which one of the following lines has slope ",m," and intercept \n",b}; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",B1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",C1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={Plot[(m^2+1)*x+(2*b+2), {x,-5,5},AxesLabel->{"x","y"}],Plot[m*x+b, {x,-5,5},AxesLabel->{"x","y"}],Plot[(m+1)*x+b+3, {x,-5,5},AxesLabel->{"x","y"}],Plot[-m*x+b-3, {x,-5,5},AxesLabel->{"x","y"}]}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{b,2,""}, (* initial value of b *) {m,1,""}, OpenerView[{Button["Try Again",qTryAgain[pn];b=RandomInteger[{-5,5}];m=RandomInteger[{-5,5}];myEnabled=True;A1=False; B1=False;C1=False; D1= False],hint[m,b]}]&}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] solutionqPlotLine3[a0_,b0_,c0_]:=Module[{a=a0,b=b0,c=c0,m,intercept,body}, m=-a/b; intercept=c/b; body={{"Calculate the slope (m) and y-intercept: \n", "Slope = "<>ToString[ToString[-a]/ToString[b],StandardForm]<>" = "<>ToString[qTrunc1[-a/b]]<>"\n", "y-intercept = "<>ToString[ToString[c]/ToString[b],StandardForm]<>" = "<>ToString[qTrunc1[c/b]]<>"\n", "For lines, always choose two points:\n", "Red Point:\nTo find y-intercept, let x = 0.\nGreen Point:\nTo find x-intercept, let y = 0."<>"\n", (*"Set x to any number e.g. where y = 0 or \n", "("<>ToString["-b"/"m",StandardForm]<>", 0) = "<>"("<>ToString[qTrunc1[-intercept/m]]<>", 0) \n", "Where the line intersects x-axis \n",*) Plot[m*x+intercept, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"},Ticks->None,ImageSize->100,Epilog->{PointSize[Medium],{Red,Point[{0,qTrunc1[c/b]}]},{Green,Point[{qTrunc1[-intercept/m],0}]}}] }, {Null,Null,Null,Null,Null,Null}}; Panel[Grid[Transpose[body]]] ] qPaneLine3[a_,b_,c_]:=ToString[Column[{"Find the x and y intercepts.","To find the x-intercept, set y=0","To find the y-intercept, set x=0"}],TraditionalForm] qPlotLine3[pn0_,a0_,b0_,c0_,diag0_]:=DynamicModule[{pn=pn0,prev,text,g1,g2,g3,g4,a=a0,b=b0,c=c0, m, intercept,hint=hint0,x,A1,B1,C1,D1,answer ,myEnabled=True,answerStudent, text2,body,answersShuffled,checksShuffled , checks, index, answers,tryAgain=True,state=False,diag=diag0,stateH=False}, qNum +=1; prev= b; If[diag==False, Style[Manipulate[ a=RandomInteger[{1,5}]*(-1)^RandomInteger[{-5,5}]; c= RandomInteger[{-5,5}]; m=-a/b; intercept=c/b; g1=Plot[(m^2+1)*x+(2*intercept+2), {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g2=Plot[m*x+intercept, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g3=Plot[(m+1)*x+intercept+3, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g4=Plot[-m*x+intercept-3, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; text={ToString[pn]<>". The line ",ToString[a],"x ",qSign[b],"y = ",c,". Which one of the following is correct?"}; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",B1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",C1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={g1,g2,g3,g4}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{b,2,""}, (* initial value of b *) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];While[b==prev,b=RandomInteger[{1,5}]];prev=b;a=RandomInteger[{1,5}]*(-1)^RandomInteger[{-5,5}];myEnabled=True;A1=False; B1=False;C1=False; D1= False;state=False],"y = mx + b, where b is y-axis intersection"}], OpenerView[{Button["Hint",qTryAgain[pn];stateH=Not[stateH]],qPaneLine3[a,b,c]},stateH], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionqPlotLine3[a,b,c]},state]},{Null,Null}}]&}, TrackedSymbols->Manipulate, SaveDefinitions->True,AppearanceElements->None,Initialization:>(prev= b)] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ a=RandomInteger[{1,5}]*(-1)^RandomInteger[{-5,5}]; c= RandomInteger[{-5,5}]; m=-a/b; intercept=c/b; g1=Plot[(m^2+1)*x+(2*intercept+2), {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g2=Plot[m*x+intercept, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g3=Plot[(m+1)*x+intercept+3, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g4=Plot[-m*x+intercept-3, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; text={ToString[pn]<>". The line ",ToString[a],"x ",qSign[b],"y = ",c,". Which one of the following is correct?"}; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"",B1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"",C1,myEnabled=False;qClickPlus[pn];text2<>"",D1, myEnabled=False;qClickPlus[pn];text2<>"", True, text2<>""]]; answers={g1,g2,g3,g4}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] solutionqPlotLineMXB1[m0_,b0_]:=Module[{m=m0,b=b0,body, intercept}, intercept=b; body={{"State whether the slope is positive or negative\nIdentify which answers are possible\nUsing the y-intercept and slope, one 1 answer is possible\n\n\nDetails:\nWe have both m and b for y = mx + b \n", "Red Point: (0, b) is where the line intersects the y-axis\n", "Green Point: (y - mx, 0)is where the line intersects the x-axis\n", "Slope or m specifies how steep line is\n", Plot[m*x+intercept, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"},Ticks->None,ImageSize->100,Epilog->{PointSize[Medium],{Red,Point[{0,b}]},{Green,Point[{qTrunc1[-intercept/m],0}]}}] }, {Null,Null,Null,Null,Null}}; Panel[Grid[Transpose[body]]] ] qPaneHintMXB1[m_,b_]:=ToString[Column[{"Use the y-intercept and the slope to help you narrow","down your choice"}],TraditionalForm] qPlotLineMXB1[pn0_,m0_,b0_,diag0_]:=DynamicModule[{pn=pn0,prev,text,g1,g2,g3,g4,b=b0, m=m0, intercept,x,A1,B1,C1,D1,answer ,myEnabled=True,answerStudent, text2,body,answersShuffled,checksShuffled , checks, index, answers,tryAgain=True,state=False,diag=diag0,stateH=False}, qNum +=1; prev= b; If[diag==False, Style[Manipulate[ m=RandomInteger[{1,5}]*(-1)^RandomInteger[{-5,5}]; intercept=b; g1=Plot[(m^2+1)*x+(2*intercept+2), {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g2=Plot[m*x+intercept, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g3=Plot[(m+1)*x+intercept+3, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g4=Plot[-m*x+intercept-3, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; text={ToString[pn]<>". Graph the line y = ",m,"x ",qSign[b]}; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",B1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",C1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={g1,g2,g3,g4}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{b,2,""}, (* initial value of b *) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];While[b==prev,b=RandomInteger[{1,5}]*(-1)^RandomInteger[{-5,5}]];prev=b;m=RandomInteger[{1,5}]*(-1)^RandomInteger[{-5,5}];myEnabled=True;A1=False; B1=False;C1=False; D1= False;state=False],"y = mx + b, where b is y-axis intersection"}], OpenerView[{Button["Hint",qTryAgain[pn];stateH=Not[stateH]],qPaneHintMXB1[m,b]},stateH], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionqPlotLineMXB1[m,b]},state]},{Null,Null}}]&}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ m=RandomInteger[{1,5}]*(-1)^RandomInteger[{-5,5}]; intercept=b; g1=Plot[(m^2+1)*x+(2*intercept+2), {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g2=Plot[m*x+intercept, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g3=Plot[(m+1)*x+intercept+3, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g4=Plot[-m*x+intercept-3, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; text={ToString[pn]<>". Graph the line y = ",m,"x ",qSign[b]}; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"",B1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"",C1,myEnabled=False;qClickPlus[pn];text2<>"",D1, myEnabled=False;qClickPlus[pn];text2<>"", True, text2<>""]]; answers={g1,g2,g3,g4}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] solutionqPlotLine4[a0_,b0_,c0_]:=Module[{a=a0,b=b0,c=c0,m,intercept,body}, m=-a/b; intercept=c/b; body={{"Calculate the slope (m) and y-intercept: \n", "Slope = "<>ToString[ToString[-a]/ToString[b],StandardForm]<>" = "<>ToString[qTrunc1[-a/b]]<>"\n", "y-intercept = "<>ToString[ToString[c]/ToString[b],StandardForm]<>" = "<>ToString[qTrunc1[c/b]]<>"\n", "Red Point:\nTo find y-intercept, let x = 0.\nGreen Point:\nTo find x-intercept, let y = 0."<>"\n", (*"Calculate the x-intercept where y = 0:\n", "x-intercept = ("<>ToString["-b"/"m",StandardForm]<>", 0) = "<>"("<>ToString[qTrunc1[-intercept/m]]<>", 0) \n", "Read point y-intercept, Green point x-intercept\n",*) Plot[m*x+intercept, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"},Ticks->None,ImageSize->100,Epilog->{PointSize[Medium],{Red,Point[{0,qTrunc1[c/b]}]},{Green,Point[{qTrunc1[-intercept/m],0}]}}] }, {Null,Null,Null,Null,Null}}; Panel[Grid[Transpose[body]]] ] qPaneHintLine4[a_,b_,c_]:=ToString[Column[{"Find the x and y intercepts.","To find the x-intercept, set y=0","To find the y-intercept, set x=0"}],TraditionalForm] qPlotLine4[pn0_,a0_,b0_,c0_,diag0_]:=DynamicModule[{pn=pn0,prev,text,g1,g2,g3,g4,a=a0,b=b0,c=c0, m, intercept,hint=hint0,x,A1,B1,C1,D1,answer ,myEnabled=True,answerStudent, text2,body,answersShuffled,checksShuffled , checks, index, answers,tryAgain=True,state=False,diag=diag0,stateH=False}, qNum +=1; prev=b; If[diag==False, Style[Manipulate[ a=RandomInteger[{1,5}]*(-1)^RandomInteger[{-5,5}]; c= RandomInteger[{-5,5}]; m=-a/b; intercept=c/b; g1=Plot[(m^2+1)*x+(2*intercept+2), {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g2=Plot[m*x+intercept, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g3=Plot[(m+1)*x+intercept+3, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g4=Plot[-m*x+intercept-3, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; text={ToString[pn]<>". The line ",ToString[a],"x ",qSign[b],"y = ",c,". Which of the following is correct?"}; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",B1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",C1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={g1,g2,g3,g4}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{b,2,""}, (* initial value of b *) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];While[b==prev,b=RandomInteger[{1,5}]];prev=b;a=RandomInteger[{1,5}]*(-1)^RandomInteger[{-5,5}];c=RandomInteger[{-5,5}];myEnabled=True;A1=False; B1=False;C1=False; D1= False;state=False],"y = mx + b, where b is y-axis intersection"}], OpenerView[{Button["Hint",qTryAgain[pn];stateH=Not[stateH]],qPaneHintLine4[a,b,c]},stateH], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionqPlotLine4[a,b,c]},state]},{Null,Null}}]&}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ a=RandomInteger[{1,5}]*(-1)^RandomInteger[{-5,5}]; c= RandomInteger[{-5,5}]; m=-a/b; intercept=c/b; g1=Plot[(m^2+1)*x+(2*intercept+2), {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g2=Plot[m*x+intercept, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g3=Plot[(m+1)*x+intercept+3, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g4=Plot[-m*x+intercept-3, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; text={ToString[pn]<>". The line ",ToString[a],"x ",qSign[b],"y = ",c,". Which of the following is correct?"}; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"",B1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"",C1,myEnabled=False;qClickPlus[pn];text2<>"",D1, myEnabled=False;qClickPlus[pn];text2<>"", True, text2<>""]]; answers={g1,g2,g3,g4}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] solutionqPlotLineSlope1[x0_,y0_,m0_]:=Module[{x=x0,y=y0,m=m0,intercept,body}, intercept=y-m*x; body={{"y = mx + b \n", "m = "<>ToString[N[m]]<>"\n", "(x, y) = ("<>ToString[x]<>", "<>ToString[y]<>")\n", "Substitute all these numbers into y = mx + b: \n", ToString[y]<>" = "<>ToString[N[m]]<>"\[Times]"<>ToString[x]<>" + b\n", "b = "<> ToString[N[y-m*x]], Plot[m*xx+intercept, {xx,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"},Ticks->None,ImageSize->100,Epilog->{PointSize[Medium],{Red,Point[{x,y}]}}] }, {Null,Null,Null,Null,Null,Null,Null}}; Panel[Grid[Transpose[body]]] ] qPaneHintLieSlope1[x_,y_,m_]:=ToString[Column[{"Find the slope and y-intercept","Slope m =\!\(\*FractionBox[\(\*SubscriptBox[\(y\), \(2\)]\(-\)\*SubscriptBox[\(y\), \(1\)]\(\\\ \)\), \(\*SubscriptBox[\(x\), \(2\)] - \*SubscriptBox[\(x\), \(1\)]\)]\)","To find y-intercept, b, substitute the slope and a point into","y=mx+b"}],TraditionalForm] qPlotLineSlope1[pn0_,x0_,y0_,m0_,diag0_]:=DynamicModule[{pn=pn0,prev,text,g1,g2,g3,g4,x=x0,y=y0, m=m0, intercept,A1,B1,C1,D1,answer ,myEnabled=True,answerStudent, text2,body,answersShuffled,checksShuffled , checks, index, answers,tryAgain=True,state=False,diag=diag0,stateH=False}, qNum +=1; prev=x; If[diag==False, Style[Manipulate[ y=RandomInteger[{-5,5}];m=RandomInteger[{-5,5}]; intercept=y-m*x; g1=Plot[(-m^2+1)*x+(2*intercept+2), {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g2=Plot[m*x+intercept, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g3=Plot[(m+1)*x+intercept+3, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g4=Plot[-m*x+intercept-3, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; text={ToString[pn]<>". Graph the line that passes through the point (",x,", ",y,")", " and has a slope ", N[m]}; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",B1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",C1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={g1,g2,g3,g4}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{x,2,""}, (*{m,1,""},*) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];While[x==prev,x=RandomInteger[{-5,5}]];prev=x;y=RandomInteger[{-5,5}];m=RandomInteger[{-5,5}];myEnabled=True;A1=False; B1=False;C1=False; D1= False;state=False],"y = mx + b, where b is y-axis intersection"}], OpenerView[{Button["Hint",qTryAgain[pn];stateH=Not[stateH]],qPaneHintLieSlope1[x,y,m]},stateH], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionqPlotLineSlope1[x,y,m]},state]},{Null,Null}}]&}, TrackedSymbols->Manipulate, SaveDefinitions->True,AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ y=RandomInteger[{-5,5}];m=RandomInteger[{-5,5}]; intercept=y-m*x; g1=Plot[(-m^2+1)*x+(2*intercept+2), {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g2=Plot[m*x+intercept, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g3=Plot[(m+1)*x+intercept+3, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g4=Plot[-m*x+intercept-3, {x,-5,5},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; text={ToString[pn]<>". Graph the line that passes through the point (",x,", ",y,")", " and has a slope ", N[m]}; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"",B1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"",C1,myEnabled=False;qClickPlus[pn];text2<>"",D1, myEnabled=False;qClickPlus[pn];text2<>"", True, text2<>""]]; answers={g1,g2,g3,g4}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] solutionPlotLine2Points1[x10_,y10_,x20_,y20_]:=Module[{x1=x10,y1=y10,x2=x20, y2=y20,m,intercept,body}, m=(y2-y1)/(x2-x1); intercept=y1-m*x1; body={{"We need to calculate y = mx + b . \n", "m the slope: \n", "m = "<>ToString["y2 -y1"/"x2 - x1", StandardForm]<>" = "<>ToString["(("<>ToString[y2]<>") - ("<>ToString[y1]<>"))"/"(("<>ToString[x2]<>") - ("<>ToString[x1]<>"))", StandardForm]<>" = "<>ToString[N[m]]<>"\n", "Solve for b i.e. y = mx + b \[DoubleLongRightArrow] b = y - mx, but plug (x1, y1) : \n", "y-intercept = b = "<>ToString[y1]<>" - "<>"("<>ToString[N[m]]<>"\[Times]"<>ToString[x1]<>") = "<>ToString[N[y1-m*x1]]<>"\n", Plot[m*xx+intercept, {xx,-8,8},AxesOrigin->{0,0},AxesLabel->{"x","y"},Ticks->None,ImageSize->100,Epilog->{PointSize[Medium],{Red,Point[{x1,y1}]},{Green,Point[{x2,y2}]}}] }, {Null,Null,Null,Null,Null,Null}}; Panel[Grid[Transpose[body]]] ] qPaneHintLine2Points1[x1_,y1_,x2_,y2_]:=ToString[Column[{"Find the slope and y-intercept","Slope m =\!\(\*FractionBox[\(\*SubscriptBox[\(y\), \(2\)]\(-\)\*SubscriptBox[\(y\), \(1\)]\(\\\ \)\), \(\*SubscriptBox[\(x\), \(2\)] - \*SubscriptBox[\(x\), \(1\)]\)]\)","To find y-intercept, b, substitute the slope and a point into","y=mx+b"}],TraditionalForm] qPlotLine2Points1[pn0_,x10_,y10_,x20_,y20_,diag0_]:=DynamicModule[{pn=pn0,text,g1,g2,g3,g4,x1=x10,y1=y10,x2=x20, y2=y20, m, prev,intercept,A1,B1,C1,D1,answer ,myEnabled=True,answerStudent, text2,body,answersShuffled,checksShuffled , checks, index, answers,tryAgain=True,state=False,diag=diag0,stateH=False}, qNum +=1; prev=x1; If[diag==False, Style[Manipulate[ y1=RandomInteger[{-5,5}];x2=x1+1+RandomInteger[{1,3}];y2=RandomInteger[{-5,5}]; m=(y2-y1)/(x2-x1); intercept=y1-m*x1; g1=Plot[(-m^2+3)*x+(2*intercept+2), {x,-8,8},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g2=Plot[m*x+intercept, {x,-8,8},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g3=Plot[(-m+1)*x+intercept+3, {x,-8,8},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g4=Plot[(m+2)*x+intercept-3, {x,-8,8},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; text={ToString[pn]<>". Graph the line that passes through the point (",x1,", ",y1,")", " and point (",x2,", ",y2,")"}; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",B1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"\n\nAnswer Correct",C1,myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)",D1, myEnabled=False;qClickPlus[pn];text2<>"\n\nAnswer \!\(\* StyleBox[\"Incorrect\",\nFontColor->RGBColor[1, 0, 0]]\)", True, text2<>"\n\nAnswer ?"]]; answers={g1,g2,g3,g4}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], {{x1,2,""}, (* initial value of b *) Grid[{{OpenerView[{Button["Try Again",qTryAgain[pn];While[x1==prev,x1=RandomInteger[{-5,5}]];prev=x1;y1=RandomInteger[{-5,5}];x2=x1+1+RandomInteger[{1,3}];y2=RandomInteger[{-5,5}];myEnabled=True;A1=False; B1=False;C1=False; D1= False;state=False],"y = mx + b, where b is y-axis intersection"}], OpenerView[{Button["Hint",qTryAgain[pn];stateH=Not[stateH]],qPaneHintLine2Points1[x1,y1,x2,y2]},stateH], OpenerView[{Button["Full Solution",qTryAgain[pn];state=Not[state]],solutionPlotLine2Points1[x1,y1,x2,y2]},state]},{Null,Null}}]&}, TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] , Style[Manipulate[ y1=RandomInteger[{-5,5}];x2=x1+1+RandomInteger[{1,3}];y2=RandomInteger[{-5,5}]; m=(y2-y1)/(x2-x1); intercept=y1-m*x1; g1=Plot[(-m^2+3)*x+(2*intercept+2), {x,-8,8},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g2=Plot[m*x+intercept, {x,-8,8},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g3=Plot[(-m+1)*x+intercept+3, {x,-8,8},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; g4=Plot[(m+2)*x+intercept-3, {x,-8,8},AxesOrigin->{0,0},AxesLabel->{"x","y"}]; text={ToString[pn]<>". Graph the line that passes through the point (",x1,", ",y1,")", " and point (",x2,", ",y2,")"}; text2=StringJoin[ToString/@text]; answer="?"; answerStudent=Dynamic[Which [A1,myEnabled=False;qClickPlus[pn];text2<>"",B1,qClick[pn];qTryAgainNOT[pn];myEnabled=False;text2<>"",C1,myEnabled=False;qClickPlus[pn];text2<>"",D1, myEnabled=False;qClickPlus[pn];text2<>"", True, text2<>""]]; answers={g1,g2,g3,g4}; checks = {Checkbox[Dynamic[A1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[B1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[C1],Enabled->Dynamic[myEnabled]],Checkbox[Dynamic[D1],Enabled->Dynamic[myEnabled]]}; (* Shuffle the answer keys *) index = RandomSample[Range[Length[answers]]]; answersShuffled = Table[answers[[index[[i]]]], {i, 1,Length[answers]}]; checksShuffled = Table[checks[[index[[i]]]], {i, 1,Length[answers]}]; body = { (* First row/colum the answer key *) {"A","B","C","D"}, (* First row/colum the proposed answers key *) answersShuffled, (* First row/colum the answer check boxes*) checksShuffled }; (* Kludge: answerStudent has problem with <>, so concatenated earlier*) Deploy[ Style[Panel[Grid[Transpose[body],Alignment->Left],answerStudent,ImageMargins->10]]], "", TrackedSymbols->Manipulate, SaveDefinitions->True,AutorunSequencing->{1,2},AppearanceElements->None,Initialization:>(qClicks = {{1, 0, 0, ""}, {2, 0, 0, ""}, {3, 0, 0, ""}, {4, 0, 0, ""}, {5, 0, 0, ""}, {6, 0, 0, ""},{7, 0, 0, ""},{8, 0, 0, ""},{9, 0, 0, ""},{10, 0, 0, ""}})] (*Manipulate*) , DynamicBoxOptions -> {BaseStyle -> Magnification -> qMagnification}] ] ] End[]; EndPackage[];