{VERSION 6 0 "IBM INTEL NT" "6.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 1 12 255 0 0 1 2 1 2 2 1 2 0 0 0 1 }{CSTYLE "Text" -1 200 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 0 0 0 1 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 2 0 2 0 2 2 0 1 }{PSTYLE "No Name" -1 205 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }3 1 0 0 0 0 2 0 2 0 2 2 0 1 }{PSTYLE "No Name" -1 206 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }3 1 0 0 0 0 2 0 2 0 2 2 0 1 }{PSTYLE "No Name" -1 207 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }3 1 0 0 0 0 2 0 2 0 2 2 0 1 }{PSTYLE "No Name" -1 208 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }3 1 0 0 0 0 2 0 2 0 2 2 0 1 }} {SECT 0 {EXCHG {PARA 205 "" 0 "" {TEXT 200 42 "Math 151 Honors-Section 202 Maplet Project" }}{PARA 206 "" 0 "" {TEXT 200 22 "Half-life of El ement X" }}{PARA 207 "" 0 "" {TEXT 200 27 "Randy Faas and Ashley Moore " }}{PARA 208 "" 0 "" {TEXT 200 17 "November 20, 2005" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart:" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 77 "with(Maplets): with(Maplets[Tools]): with(Maplets[E lements]): \nStartEngine();" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "randomize():" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 200 201 "This sectio n of code creates the maplet window. It makes a window with a new pro blem button, a shutdown button, a check answer button, a show answer b utton, 2 question text fields and an answer field." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 884 "HalfLife:=Maplet(onstartup = RunWindow(MAI N),\nWindow[MAIN]('title'=\"Half-life of Element X\", defaultbutton=Ch eck,\n [ [ Button(\"New Problem\", Evaluate('function'=\"ask\")),\n \+ \" \",\n Button(\"Hint\", Evaluate('function'=\"hin t\")),\n Button(\"Quit\", Shutdown())\n ],\n [ TextField['q uestion1'](\"The Half-life of Element X is T years.\", 'width'=40, 'ed itable'='false')\n ],\n [ TextField['question2'](\"If you start \+ out with A0 grams, how much is left after t years?\", 'width'=40, 'edi table'='false')\n ],\n [ \"Answer: \",\n TextField['answer' ]('width'=25)\n ],\n [ Button[Check](\"Check Answer\", Evaluate( 'function'=\"check\")),\n \" \",\n Button(\"Show \+ Answer\", Evaluate('function'=\"show\"))\n ],\n [ TextField['rep ly'] ('width'=40, 'editable'='false')\n ],\n [\"Programmers: Faa s & Moore Copyright P. Yasskin 2005\"\n\n ]\n ]\n)\n):" }}} {EXCHG {PARA 0 "" 0 "" {TEXT 200 71 "This part defines the problem and asks the question in the text fields." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 511 "ask:=proc()\nglobal correcthalflife;\nlocal h, t, a, randh, randt, randa;\nrandh:=rand(5..10):\nrandt:=rand(5..10):\nranda :=rand(100..200):\nh:=randh();\nt:=randt();\na:=randa();\nwhile (h=t) \+ do\n h:=randh();\nend do;\ncorrecthalflife:=a*(1/2)^(t/h);\nSet('ques tion1'=cat(\n \"The Half-life of Element X is \", convert(h,string), \+ \" years.\"\n ));\nSet('question2'=cat(\"If you start out with \", co nvert(a,string), \" grams, how much is left after \", convert(t,string ), \" years?\"\n ));\nSet('reply'=\"\");\nSet('answer'=\"\");\nend pr oc:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 200 63 "This section creates the \+ procedure for the check answer button." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 302 "check:=proc()\nglobal correcthalflife;\nlocal userha lflife;\nuserhalflife:=Get('answer'::'realcons', corrections=true, upd ate=true):\nif evalf(abs(userhalflife-correcthalflife)) < 10^(-2)\n t hen Set('reply'=\"You're krunk! Go again!\")\n else Set('reply'=\"Sor ry, you're wrong. Try again.\")\nend if;\nend proc:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 200 62 "This section creates the procedure for the sho w answer button." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 92 "show:=p roc()\nglobal correcthalflife;\nSet(answer=correcthalflife);\nSet('rep ly'=\"\");\nend proc:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 200 48 "This se ction creates the procedure for the hint." }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 60 "hint:=proc()\nSet('reply'=\" A = A0 * (1/2)^(t/T)\" );\nend proc:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "Display(Ha lfLife);" }}}}{MARK "0 0 0" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 } {PAGENUMBERS 0 1 2 33 1 1 }