Submit one PDF file that contains all of your program code (including comments).
Include comments or acknowledgments for any part of the submitted program code that has been written by someone other than you and/or your collaborative partner(s).
In your program, you must include student-developed program code that contains the following:
Instructions for input from one of the following:
the user (including user actions that trigger events)
a device
an online data stream
a file
Use of at least one list (or other collection type) to represent a collection of data that is stored and used to manage program complexity and help fulfill the program’s purpose
At least one procedure that contributes to the program’s intended purpose, where you have defined:
the procedure’s name
the return type (if necessary)
one or more parameters
An algorithm that includes sequencing, selection, and iteration that is in the body of the selected procedure
Calls to your student-developed procedure
Instructions for output (tactile, audible, visual, or textual) based on input and program functionality
Programs are designed using common building blocks. These building blocks, known as programming constructs, form the basis for all programs.
There are three basic building blocks to consider:
sequence (order of code)
selection (logic and decision making aka conditions)
iteration (repetition of code)
Sequence is the order in which instructions occur and are processed. Selection determines which path a program takes when it is running. Iteration is the repeated execution of a section of code when a program is running.
There are two types of iteration:
count-controlled iteration
condition-controlled iteration
All programs use one or more of these constructs. The longer and more complex the program, the more these constructs will be used repeatedly.
Count-controlled iteration
In a count-controlled loop, the number of iterations is specified in advance and the loop continues to run for a fixed number of times. The for loop is a common example of a count-controlled loop in JavaScript. Here is an example of count-controlled iteration in JavaScript:
Condition-controlled iteration
In a condition-controlled loop, the number of iterations is not specified in advance and the loop continues to run until a specific condition is met. The while loop is a common example of a condition-controlled loop in JavaScript. Here is an example of condition-controlled iteration in JavaScript: (LEFT)
In this code, the while loop runs a block of code until the counter variable reaches a value of 5. The counter variable is incremented each time the loop runs, and the final value of the counter is printed to the console after the loop has completed.