Programming Languages Chapter 6 The Focus This Conditionals Use Simple Section Change Pixels Their

subject Type Homework Help
subject Pages 1
subject Words 405
subject Authors Barbara Ericson, Mark J. Guzdial

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
Chapter 6
The focus in this chapter is on conditionals. We use a simple if in section 6.1 to change pixels if
their color is close to a specified color. We motivate this by showing how to remove fired eye”
from a picture. You can have students change the color in part of a picture to a new color. You
can have students run through a flow chart on the floor to see if they understand conditional
execution and loops. You might set up a flow chart with blue painter’s tape on the floor that has
a loop and a conditional based on the result of a dice throw. If the number on the dice roll is less
than 3 have the student clap. See
In section 6.2 we introduce conditionals with two options. We motivate this by doing simple
edge detection. You can add something to the flow diagram like if the number on the dice roll is
greater than 3 wave your hand.
In section 6.3 we show how to deal with conditionals with 3 or more options. We motivate this
by creating sepia-toned pictures and posterized pictures. You can add something to the flow
diagram like if the number is equal to 3 say your name.
In section 6.4 we introduce using an ‘or’ to join two conditions by highlighting pixels that are
close to white or close to black. You can have students stand up and tell them to sit if any of the
In section 6.5 we introduce using ‘and’ to join two conditions by blurring pixels. The ‘and’
keeps us from going past the end of the two-dimensional array. You can play the Guess Who
In section 6.6 we show using a simple conditional to replace a background and do chromakey.
This shows how powerful even a simple condition can be.

Trusted by Thousands of
Students

Here are what students say about us.

Copyright ©2022 All rights reserved. | CoursePaper is not sponsored or endorsed by any college or university.