A good answer might be:

Some Machines that Use Cycles

  • Bicycle --- your legs drive the pedals connected to a gear which spins.
  • CD Player --- the disk spins (cycles) as the laser moves across it.
  • TV Set --- pictures are put one the screen one after another as long as the set is on.
  • Water Pump --- often a piston repeatedly moves in and out of a cylinder.
  • Laundry Dryer --- rotating drum.
  • Clock --- shows the same times every day. If the clock is mechanical, its insides are gears and springs with many mechanical cycles. If the clock is electronic the cycles are still there, but harder to see.
  • Sun and the Earth --- endlessly cycling, seasons flowing one into the next.
Perhaps the ultimate example of the usefulness of cycles is the ultimate machine itself---the wheel.

The while statement

Here is a Java program that has a loop in it:
import java.io.*;
// Exampe of a while loop
class loopExample
{
  public static void main (String[] args ) 
  {
    int count = 1;                                  // start count out at one
    while ( count <= 3 )                            // loop while count is <= 3
    {
      System.out.println( "count is:" + count );
      count = count + 1;                            // add one to count
    }
    System.out.println( "Done with the loop" );
  }
}


You would learn a lot if you imported this program into NotePad and ran it in the DOS window (using the "copy-paste-and-run" method.) The statement count = count + 1; increases the value stored in the variable count by adding one to it. Or, you can run a JavaScript version of the program by clicking the button:


If you look at the source for this page using your browser's "View Source" menu item, you will see the JavaScript that is responsible for the above. JavaScript is similar to Java, but has some big differences, so be careful not to get confused.

QUESTION 2:

What does this statement do:

      count = count + 1;

Click Here after you have answered the question