8 CSinAlgebra|Lesson8 CompositeFunctions Lessontime:30-60Minutes LESSONOVERVIEW Inthepastlessonsstudentshavedefinedvariableswhichwillallowthemtoeasilywriteexpressionsthatreferto thesamevaluerepeatedly.Inthisstage,theywillwritesimplefunctionsthat,likevariables,allowstudentsto abstractoutrepetitiouselementsoftheirprograms. LESSONOBJECTIVES Studentswill: Analyzeanduseexistingfunctions. Modifyexistingfunctions. Createnewfunctions. Createsimilarshapesbychangingsizeparametersonfunctions. ANCHORSTANDARD CommonCoreMathStandards 8.F.1:Understandthatafunctionisarulethatassignstoeachinputexactlyoneoutput.Thegraphofafunction isthesetoforderedpairsconsistingofaninputandthecorrespondingoutput.1 Additionalstandardsalignmentcanbefoundattheendofthislesson TEACHINGSUMMARY GettingStarted 1)Vocabulary 2)Introduction Activity:CompositeFunctions 2)OnlinePuzzles TEACHINGGUIDE GETTINGSTARTED 1)Vocabulary Thislessonhasonenewandimportantword: Parameter-Avalueorexpressionbelongingtothedomain. 2)Introduction Definingareusablevalueishelpfulwhenaprogramhaslotsofidenticalexpressions.Sometimes,however,a programhasexpressionsthataren’tidentical,butarejustverysimilar.Aprogramthathasfiftysolid,green trianglescanbesimplifiedbydefiningasinglevalue,aslongastheyareallthesamesize.Butwhatifaprogram hasfiftysolid,greentrianglesofdifferentsizes? ThinkabouttheImagefunctionsyouhavealreadyused,likestarandcircle.Theytakeinputsandproduce images.Similarly,wemightwantagreen-trianglefunctionthattakesthesizeasaninputandproducesagreen triangle.Theprogramminglanguagedoesn’tprovidethisfunction,butitdoesletyoudefineyourownfunctions. Wewanttodefineourownfunction(let’scallitgt,forgreentriangle)thattakesinaNumberasthesizeparameter andproducesasolidgreentriangleofwhateversizewewant.Forexample: andsoon... ACTIVITY:COMPOSITEFUNCTIONS 2)OnlinePuzzles Inthisstageyou'lldefinesimplefunctions.HeadtoCSinAlgebrastage8inCodeStudiotogetstarted programming. Derivedfrom
© Copyright 2024