CS 100 Spring 2014
Lab 6
Functions
Due Monday April, 7th

Using the Processing language/environment answer the questions below.

Consider the following code written in immediate mode.

size(100, 100); 
noStroke(); 
smooth();


fill(255); 
ellipse(50, 50, 60, 60); // White circle
fill(0); 
ellipse(60, 50, 30, 30); // Black circle 
fill(255); 
ellipse(66, 45, 6, 6);  // Small, white circle
Before running the program

Run the program.

1. [1 pt] Consider the following function version of the code above. Before running the program

Now paste the code in a file eyeFunc.pde, run it and do the following.

2. [3 pts] Save your previous program with the following new name eyeFunc2.pde.
In this program define a new function called eye that

Modify the function body of myDrawing

Once your program creates one eye, add another call to the function body of myDrawing to produce a pair of eyes. The result should be similar to the following image.

3. [3 pts] Save your previous program with the following new name eyeFunc3.pde.
Modify it to produce an image similar to the following.

Hints:

4. [3 pts] Modelled on the palette program you wrote in lab 4, write a program eyePalette that produces an image similar to the following one.

Hints:

Bonus

Rewrite a subset of your assignment 2 using functions.