/*
download this. save as p41.java. remove html tags.


CIS 790            JAVA PROGRAMMING        PROF. AUCIELLO 

      TOPICS:   Classes
                System Input (kb) & Output (display)
                Character Conversion (char) = int to char.
                Error-Trapping {try..  catch..} = [Exception]
                If (cond)  {then execution}
                For (cond) {do loop}
                != is 'not equal'   

Creates this output:

ASCII = 1st 256 UNICODES!

ASCII Character =     ASCII Code = 0
ASCII Character =    ASCII Code = 1
ASCII Character =    ASCII Code = 2
ASCII Character =    ASCII Code = 3
ASCII Character =    ASCII Code = 4
ASCII Character =    ASCII Code = 5
ASCII Character =    ASCII Code = 6
ASCII Character =    ASCII Code  = 7
ASCII Character =   ASCII Code   = 8
ASCII Character =          ASCII Code = 9
ASCII Character =
   ASCII Code = 10             (10 = line feed, remember?)
ASCII Character =    ASCII Code = 11

----------------------
*/


import corejava.*;   // allows Console.readString function
import java.io.*;    // "java.io" is part of the class library 
                     // (classes.zip).  It contains the routines
                     // (macros) required for IO Exception and
                     // system Input / Output.  
                     // comment it out to see what happens.
                     // Links to a class called 'java.io.*'

public class p41     // This class-name (p41) must be defined in a file
                     // called "p41.java" (else woe unto your program)

{ public static void main (String args[])                                     
  { int     inChar;                                                              
    String  svar;
    System.out.println("ASCII = 1st 256 UNICODES!");                                 
    try { for (int i=0; i<256; ++i)                                   
          { System.out.print("ASCII Character = " + (char)i);
            if (i != 0)
               {System.out.println("   ASCII Code = " + i);}
            else
               {System.out.print  ("   ASCII Code = " + i);}
            svar = Console.readString(); 
          }   // ends for
        }  // ends try            

    catch (Exception e)           
        {String err = e.toString();
         System.out.println("The following error occurred:  " + err);  }
  }  // ends public                                                                           
}  // ends class                                                      

/* try ... catch allows programmer to capture an error caused during
           execution and deal with it, preventing a program "crash"
           which is a return to the Operating System.



Assignment: 
Print out Z-A.  
(figure out the decimal code for 'Z')
Show me what you know.

Answer these questions / Checklist Items:

What does 'e.toString()' do?
What does 'String err = e.toString()' do?
(you should be getting an understanding of the way Java says things
 [syntax]).

The if (condition)
       {execute if true}
    else
       {execute if false}

should be clear to you at this time.  If not, practice
with it.  change 'i = 0' to 'i = 4' (any integer). note
the changes.  Apply a Plan-Do-Check-Act-Improve thinking paradigm.


At this point, you should be able to clearly understand the
use of brackets {} and should be able to sense the style of using
them for the public group, the class group, try group, for group,
catch group.  You should be able to recognize the pattern.

Please Complete the Chart of Ascii Codes for an additional 100 points.
(On the table of assignments.)

(p41.java embedded in p41.html)

end of listing

*/