# Jonathan Durham # Zach Bailey # Section 202 # 12-6-02 # Project 3: Maplet restart: with(Maplets):with(Maplets[Tools]):with(Maplets[Elements]):with(plots): StartEngine(): Jack:=Maplet(onstartup=RunWindow(MAIN), Window[MAIN]('title'="Jack Be Nimble", [ [TextBox['TB1']("Jack is easily tempted by peer pressure. One day he goes with his friends to the lake to ski and they dare him to climb up a bluff and jump off of it. The problem is that Jack doesn't know how high the cliff is. On his way up he starts to think that if he hits the water at over 20 m/s that he probably will never make it back to Dr. Yasskin's math class again. Just this thought makes him scared for his life. Since you know how high the bluff is in meters and also Jack's starting horizontal velocity in m/s try and figure out what will happen to Jack. He will have no starting vertical velocity since he jumps straight out. \n Try to find the height and velocity so he can survive.", width=60, height=5) ], [ "Height:", TextField['high']('width'=25), "m ", "Horizontal Velocity:", TextField['vel'] ('width'=25), "m/sec " ], [Button("Plot Jack's Trajectory", 'onclick'='Plot_It') ], [Button("Good Bye", Shutdown()) ] ] ), Window[PlotIt]('title'="Jack's Trajectory", [ [Plotter['myplot']('width'=300, 'height'=200) ], [TextBox['TimeHit'](width=2,height=2) ], [TextBox['VelHit'](width=2,height=2) ], [TextBox['Success'](width=1,height=1) ], [ Button("Try Again", CloseWindow(PlotIt)) ] ] ), Action['Plot_It'] (RunWindow(PlotIt), Evaluate('function'="plothigh") ) ): plothigh:=proc() local userhigh, uservel, x1, y1, trange, p1, timeToImpact, Vely, Velatimpact; global mark; userhigh:=Get(thismaplet,'high'::realcons); uservel:=Get(thismaplet, 'vel'::realcons); x1:=uservel*t; y1:=userhigh-9.8/2*t^2; timeToImpact:=sqrt(2*userhigh/9.8): Vely:=(9.8*timeToImpact); Velatimpact:=sqrt((Vely)^2+(uservel)^2); trange:=0..timeToImpact; Set('VelHit'=cat("Velocity at Impact: ",convert(Velatimpact, string)," m/sec")): Set('TimeHit'=cat("Time to Impact: ",convert(timeToImpact, string)," sec")): if Velatimpact <= 20 then Set('Success'= "JACK IS ALIVE!!") else Set('Success'= "PRAY FOR JACK!!") end if; p1:=plot([x1,y1,t=trange], thickness=5, color=green); Set(thismaplet,'myplot'=p1); end proc: Display(Jack);