/*
 *Mr. Whittington
 *24/11/03
 *
 *This program shows the structure of for loops and while loops in
 *java.
 *
 */


import java.awt.*;
import java.awt.event.*;

class Loops 
{
	
	public static void main(String args[]) 
	{
		System.out.println("Starting Loops...");
		
		// Variables
		char a = 'A';
		
		
		/* For loop:
		 *Repeats a set number of times.  The counter variable, in
		 *this case "c" counts by what ever is in the iteration 
		 *until the ending condition is met.
		 *
		 *for (starting value; ending condition; iteration)
		 *
		 *NOTE: There is no semi-colin at the end of the above
		 *line.
		*/ 
		System.out.println("\nFor Loop:");
		for (int c=0; c<=10; c++)
			System.out.print(c);
		
		
		/* While loop:
		 *Repeats as long as the condition is true.
		 *
		 *while (condition) NO SEMI-COLIN
		*/ 
		System.out.println("\nWhile Loop:");	
		while (a != 'z')
		{ // start while
			System.out.print(a);
			a++;
		} // end while
		
		// Reset "a"
		a='A';
		System.out.println();
		
		// This loop prints the ASCII code of each letter.
		while (a != 'z')
		{ // start while
			// Converts "a" to an integer and prints the value.
			System.out.print((int)a + " ");
			a++;
		} // end while
		System.out.println();
	}
}
