Chapter1Printed.pdf - 1.1 Programming introduction A recipe consists of instructions that a chef executes likezyBooks adding eggs or stirring 16:38

Chapter1Printed.pdf - 1.1 Programming introduction A recipe...

This preview shows page 1 - 5 out of 46 pages.

1.1 Programming introductionA recipe consists of instructionsthat a chef executes, like adding eggs or stirring ingredients. Likewise, a computer programconsists of instructions that a computer executes (or runs), like multiplying numbers or printing a number to a screen.Figure 1.1.1: A program is like a recipe.PARTICIPATIONACTIVITY1.1.1: A first computer program.Run the program and observe the output. Click and drag the instructions to change the orof the instructions, and run the program again. Not required (points are awarded just for interacting), but can you make the program output a value greater than 500? How about greater than 1000? ©zyBooks 04/22/18 16:38 313241Cristina Donaldson ITS320ZybookInteractiveText2018 m
Image of page 1
PARTICIPATION ACTIVITY 1.1.2: Instructions. Select the instruction that achieves the desired goal. 1) Make lemonade: Fill jug with water Add lemon juice • ____________________ • Stir 2) Wash a car: Fill bucket with soapy water Dip towel in bucket Wipe car with towel • ____________________ 3) Wash hair: Rinse hair with water While hair isn't squeaky clean, repeat: ____________________ Work shampoo throughout hair Rinse hair with water Add salt Add water Add sugar Rinse car with hose Add water to bucket Add sugar to bucket Rinse hair with water Add shampoo to hair Sing ©zyBooks 04/22/18 16:38 313241 Cristina Donaldson ITS320ZybookInteractiveText2018 ©zyBooks 04/22/18 16:38 313241 Cristina Donaldson ITS320ZybookInteractiveText2018
Image of page 2
4) Compute the area of a triangle: Determine the base Determine the height Compute base times height • ____________________ Multiply the previous answer by 2 Add 2 to the previous answer Divide the previous answer by 2 1.2 Computational thinking Imagine that a chef creates a new dish that she wants to share. The chef writes a recipe that consists of the most basic steps required to create a copy of the dish: chop one onion, dice two tomatoes, mix with lettuce, etc. Task decomposition means to reduce a complex task into simpler basic steps, making the whole task easier to solve. Like a new dish, a computer program is generally created by decomposing a task into simpler basic steps, and then instructing a computer to perform those steps in a certain order. Table 1.2.1: Examples of task decomposition. Task description The task decomposed into group of simpler problems. Fight crime 1. Put on cape 2. Put on mask 3. Get in crime-fighting vehicle 4. Arrest villain 5. Return to hideout Vacuum room 1. Get vacuum from closet 2. Plug in vacuum to power outlet ©zyBooks 04/22/18 16:38 313241 Cristina Donaldson ITS320ZybookInteractiveText2018 ©zyBooks 04/22/18 16:38 313241 Cristina Donaldson ITS320ZybookInteractiveText2018
Image of page 3
3. Lower vacuum handle 4. Roll forwards 5. Roll backwards 6. Roll forwards 7 . ...
Image of page 4
Image of page 5

You've reached the end of your free preview.

Want to read all 46 pages?

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture