OBJECTIVES: By the end of this lesson, students will:
Demo. Click Add then item, to add to list. Click Delete, then item to cut from List.
CSTA 2-AP-10: Use flowcharts and/or pseudocode to address complex problems as algorithms.
CSTA 2-AP-11: Create clearly named variables that represent different data types and perform operations on their values.
Slides:
Show Top 5 lists. Ask class for tope 5 ideas?
Show the difference between Variables and Lists. Slides 7 -10
Preview today's project. Students should get their checkout working for the strawberry and then add extra items to their game.
Preview today's project.
Students should get their checkout working for one item: strawberry , then make it work for other items.
Other fun list projects: Garbage Sort. Chatbot Lists
Today you used abstraction. You created a high level plan that hid the complexity at a lower level.
Discuss the following questions:
Why is it a good idea to hide complexity at lower levels?
Multiplication is a math command, shown under operators. What other math commands can you find under operators?
Look at your coding blocks. How many variables did you use. Explain to a partner why you needed each of these variables in your code.
Abstraction hides details at a lower level to simplify complex systems.
It improves efficient and makes code easier to read. It also allows your code to work with a bigger range of scenarios.
E.g. The Madlibs project generated lots of sentence output, form one sentence frame and a variety of two word inputs.
Math operators: Addition, subtraction, divide, mod, round.
Mod returns the remainder - useful for telling if a number is odd or even.
Round: rounds to the nearest whole number.
Note: Square root can be changed to 14 other math functions including sin and cosine.
Students use four variables:
Number 1, Number 2: to hold random numbers, used in formulating game question and calculating.
CorrectAnswer: to store the correct math answer
Score: to store the players' score.