var EIII1 = new example (
  "Example III.0",
  "This example shows how you can limit a value using the <CODE>if()</CODE> programming concept. \
  The code following the <CODE>if()</CODE> is only executed if its specified condition evaluates to true. \
  In this example, the perimeter of the circle follows the mouse, but will never exceed the width of the screen.",
  "exampleIII1",
"void draw() {<BR>\
  background(102);<BR>\
  <BR>\
  r = (int) dist(x,y,mouseX,mouseY);<BR>\
  if (r > width/2) {<BR>\
    r = width/2;<BR>\
  }<BR>\
  <BR>\
  circle (x, y, r);<BR>\
}");


var EIII2 = new example (
  "Example III.1",
  "This example shows the use of <CODE>if</CODE> and <CODE>else</CODE> statements (commonly \
  known as 'if-then-else'). If the mouse pointer is inside the circle then the circle is dark grey; else \
  the circle is light grey. Note that you don't need to use the brackets following the <CODE>if</CODE> or \
  <CODE>else</CODE> in the next example (but it is wise to do so).",
  "exampleIII2",
"void draw() {<BR>\
  background(102);<BR>\
  d = (int) dist(x,y,mouseX,mouseY);<BR>\
  if (d <= r) {<BR>\
    fill(52);<BR>\
  }<BR>\
  else {<BR>\
    fill(204);<BR>\
  }<BR>\
  circle (x, y, r);<BR>\
}");


var EIII2b = new example (
  "Example III.2",
  "In this example we introduce a new data type: <CODE>boolean</CODE>. \
  Boolean expressions can only have values <CODE>true</CODE> or <CODE>false</CODE>, and can be combined and manipulated with operators <CODE>&&</CODE>, <CODE>||</CODE>, and <CODE>!</CODE>. \
  in this example, the screen turns white if the mouse pointer is above the /-diagonal or exactly on the \\-diagonal.",
  "exampleIII2b",
"boolean m, n;<BR>\
  <BR>\
void draw() {<BR>\
  m = (mouseX == mouseY);<BR>\
  n = (mouseX + mouseY) > width;<BR>\
  <BR>\
  if (m || !n) {<BR>\
    background(255);<BR>\
  } else {<BR>\
    background(102);<BR>\
  }<BR>\
}");


var EIII3 = new example (
  "Example III.3",
  "This is a very simple example of the 'for loop'. The 'for loop' can be used \
  to repeat something several times. This program draws 8 horizontal lines at \
  equal vertical distances. Note the syntax of the 'for loop' very carefully!",
  "exampleIII3",
"size(200, 200);<BR>\
background(102);<BR>\
 <BR>\
for (int i=0; i<8; i++) {<BR>\
  int y = i * (height/8);<BR>\
  line(0, y, width, y);<BR>\
}");


var EIII3b = new example (
  "Example III.3b",
  "This example does the exact same thing as the previous one. However, it uses a \
  'while loop' instead of a 'for loop'. Note how the structure of both loops is very similar.",
  "exampleIII3b",
"size(200, 200);<BR>\
background(102);<BR>\
 <BR>\
int i=0;<BR>\
while (i < 8) {<BR>\
  int y = i * (height/8);<BR>\
  line(0, y, width, y);<BR>\
  i++;<BR>\
}");


var EIII4 = new example (
  "Example III.4",
  "This program shows an example of a nested loop: one loop nested inside another. \
  We fill the window with 25 circles. This structure (the nesting of two loops) is \
  very common in two-dimensional problems. Study it very carefully!",
  "exampleIII4",
"size(200, 200);<BR>\
background(102);<BR>\
 <BR>\
int n = 5;<BR>\
int r = width/(n*2);<BR>\
int d = 2*r;<BR>\
 <BR>\
for (int x=r; x < width; x += d) {<BR>\
  for (int y=r; y < height; y += d) {<BR>\
    ellipse(x, y, r*2, r*2);<BR>\
  }<BR>\
}");


var EIII5 = new example (
  "Example III.5",
  "This example is much like Example III.4. However, the radii of the circles depend on \
  the position of the mouse: the closer the mouse is to the center of a circle, the larger \
  its radius.",
  "exampleIII5",
"void draw() {<BR>\
  background(102);<BR>\
  for (int x=r; x < width; x += d) {<BR>\
    for (int y=r; y < height; y += d) {<BR>\
      int r = (int) (R * (1.0 -<BR>\
        dist(x, y, mouseX, mouseY) / D));<BR>\
      circle(x, y, r);<BR>\
    }<BR>\
  }<BR>\
}");


var AIII1 = new assignment (
  "Assignment III.1",
  "Make a program that draws a circle that follows the mouse pointer slowly. \
  If the circle reaches the mouse, its color changes. It is wise to use a variable \
  containing the 'speed' of the circle, such that if it equals 1.0 the circle \
  immediately 'jumps' to the mouse, and if it equals 0.0 the circle does not move.",
  "assignmentIII1",
  dateIII);


var AIII2 = new assignment (
  "Lab Assignment III.2",
  "Make a program that draws eight circles on top of each other: starting with a \
  black one the size of the screen, and ending with a small white one. Towards the \
  center of the screen, the circles become lighter and smaller.",
  "assignmentIII2",
  dateIII);
