10/28-11/1


In this lesson, students will learn in greater detail about for loops. For loops in Javascript are written and executed in the same manner as Karel exercises, except now students will explore modifying the initialization statement, test statement, and increment statements of the loops.

Objective

Students will be able to…

  • Create for loops in JavaScript
  • Explain the purpose of for loops
  • Utilize for loops to avoid typing out repeated code
  • Use the loop counter i inside the for loop code to do something different on each iteration

For loops in Javascript are written and executed in the same manner as the Karel exercises. However, now we explore in more detail the other parts of the loop besides using it as just a counter. We can modify the initialization statement, test statement, and increment statement. The caterpillar problem is one of the more challenging problems because it has students combine several concepts. You will probably spend a week on for loops.

Objective

Students will be able to…
* Explain the three parts of the for loop (initialization statement, test statement, increment statement)
* Create for loops that iterate differently than the basic for loop structure (ie count by twos or count backwards)


For loops in Javascript are written and executed in the same manner as the Karel exercises. However, now we explore in more detail the other parts of the loop besides using it as just a counter. We can modify the initialization statement, test statement, and increment statement. The caterpillar problem is one of the more challenging problems because it has students combine several concepts. You will probably spend a week on for loops.

Objective

Students will be able to…

  • Explain the purpose of for loops
  • Create for loops to solve increasingly challenging problems
  • Create nested for loops: for loops inside of for loops

A randomizer gives a program the appearance of randomly generated number, color or attribute in a program. The Randomizer can be used in conjunction with nextInt(low, high)nextBoolean()nextFloat(low, high), and nextColor(). It can be utilized to make programs more interesting and engaging for users. With this lesson, students will be made to see how randomization can enhance a program and used in combination with various control structures.

Objective

Students will be able to…
* Explain why random numbers are a useful part of computer programs
* Create random values in a program
* Create programs that do something different on each run depending on random values that are generated
* Utilize the DOCS for the Randomizer class in order to learn how to generate random values


In this lesson students will explore while loops and JavaScript variables. This combines the ideas of creating variables, updating variables throughout a loop, and determining the correct ending condition. Note that the fibonacci problem is a bit tricky, so you may want to discuss the idea of that on the board or projector.

Objective

Students will be able to…

  • Explain the purpose of a while loop
  • Create while loops to repeat code while a condition is true
  • Utilize while loops to solve new types of problems

A Loop and a Half is a specific way to write a while loop with the condition being true. Inside the loop, you compare to a SENTINEL value to break out of the loop. This structure often allows you to write less code.

Objective

Students will be able to…
* Explain the how the loop-and-a-half structure is different from a traditional while loop
* Explain what an infinite loop is
* Explain what the break statement does
* Create programs that use the loop-and-a-half structure to repeat code until a SENTINEL is met, causing the program to break out of the loop

Leave a Reply

Your email address will not be published. Required fields are marked *