Rocket Height

10
CSinAlgebra|Lesson10
RocketHeight
Lessontime:30-60Minutes
LESSONOVERVIEW
UsingtheDesignRecipe,studentswillworkthroughaseriesofwordproblemsaboutcalculatingtheheightofa
rocketafteragivennumberofsecondsfromlaunch.Thefunctionstheywritewillbeusedtoanimatetherocket
launch.
LESSONOBJECTIVES
Studentswill:
Designfunctionstosolvewordproblems.
UsetheDesignRecipetowritecontracts,testcases,andfunctiondefinitions.
ANCHORSTANDARD
CommonCoreMathStandards
F.LE.1:Distinguishbetweensituationsthatcanbemodeledwithlinearfunctionsandwithexponential
functions.
Additionalstandardsalignmentcanbefoundattheendofthislesson
TEACHINGSUMMARY
GettingStarted
1)Introduction
Activity:RocketHeight
2)OnlinePuzzles
ExtensionActivities
3)Non-linearAnimation
TEACHINGGUIDE
MATERIALS,RESOURCES,ANDPREP
FortheStudent
Rocket-HeightDesignRecipe(inthestudentworkbook)
GETTINGSTARTED
1)Introduction
Functionsareakeypartofanimationincomputerprograms.Afunctionthatdrawsastaticpictureofabat,for
example,canplacethebatatadifferentlocationbasedontheinput.Whenthatinputchangesslightlybasedon
timeoruser-interaction,thebatwillappeartomove.Thisissimilartothewaythatflip-bookanimationswork,in
whicheachpagedrawsastaticimagethathaschangedbyasmallamount.Whenthepagesaredisplayed
quickly,theimagesappeartochangesmoothly.
Puttingtheseimagestogether,wearriveatananimationofthebatturningaround.
Intheonlinepuzzles,studentswillfindablackblockforeachfunctionthey
create,inadditiontothecoloredblockstheyareusedto.Theblackfunction
box,whichhasnoparameterinputs,representsthefunctionasaTypeof
data.Thisallowsyoutopassyourfunctionintothe'start'function,whereitcanbeusedtocontroltherocket
animation.
Anothercuriositywiththisprogramisthattherocket-heightfunctionwillbeexecutedmultipletimes.Theperiodic
executioncreatestheflip-bookeffect.Aseachsecondpasses,therocket-heightfunctionisexecutedagain,the
newlocationiscalculated,andtherocketisre-drawninitsnewlocation.Thisdrawingandre-drawingindifferent
locationsgivestheappearanceofmotion.
LESSONTIP
Aftercreatingsimplelinearmovement,studentswillbeaskedtowritefunctionstoanimatesimple
acceleration.Studentswillbegivenaninput/outputtablefromwhichtowritetheirnewfunction.You
maywanttoworkthroughtheseproblemsasawholeclass,sothatstudentscanseehowyoumight
analyzeaninput/outputtableinorderunderstandtherelationshipbetweeninputandoutputvalues.
ACTIVITY:ROCKETHEIGHT
2)OnlinePuzzles
Inthisstageyou'llwritefunctionsthatmanipulateimagestocreateanimations.HeadtoCSinAlgebrastage10in
CodeStudiotogetstartedprogramming.
EXTENSIONACTIVITIES
3)Non-linearAnimation
ThefinalpuzzleofthisstageisaFreePlaypuzzlethatwillallowyouamdyourstudentstoexperimentwithother
variationsontherocket-heightformula.Oneactivitythatstudentsfindparticularlyinteresting(andoften
challenging)istowritefunctionsthatproducenon-linearacceleration.Ifyourstudentsarefamiliarwithquadratics
thenyoucancallthisoutassuch,butevenyoungerstudentswhohaven'tyetseenquadraticscanenjoythis
extensionchallenge.
Placethefollowinginput/outputtablesontheboardandseeifstudentscancomeupwithfunctionsthatwill
producetheappropriateanimation.
Challenge1
Challenge2
Input
Output
Input
Output
1
10
1
15
2
40
2
45
3
90
3
95
4
160
4
165
OncestudentshavefiguredouttheprovidedInputOutputtables,encouragethemtocomeupwithnon-linear
animationfunctionsoftheirown.
Derivedfrom
ThiscurriculumisavailableunderaCreativeCommonsLicense(CCBY-NC-SA4.0)
IfyouareinterestedinlicensingCode.orgmaterialsforcommercialpurposes,contactus:https://code.org/contact