/*******************************************************************
** This program is an application with an statement where ther is
** a division by ZERO and the application execution should be
** terminated at this statement.  This an illustration of why and
** how to create an exceptional handling code.
********************************************************************/
public class DividByZeroProg
{
  public DividByZeroProg()
  {
    final int   ZERO = 0;
    int         IntegerValue;
    float       FloatValue;

    IntegerValue = 2;
    FloatValue = 10 / IntegerValue;
    System.out.println("10 / 2 = \t" + FloatValue);
    // can not divid by 0 directly, must use a property(varaible)
    IntegerValue = ZERO;
    // prompt before bombing
    System.out.println("Press Enter key to continue");
		try
	{
		System.in.read();
	}
	catch(Exception myException)
	{// do nothing
	}

    FloatValue = 10 / IntegerValue;
    System.out.println("10 / 2 = \t" + FloatValue);
  }
  /****************************************************/
  public static void main(String [] args)
  {
    DividByZeroProg  MyDividByZeroProg = new DividByZeroProg();
	try
	{
		System.in.read();
	}
	catch(Exception myException)
	{// do nothing
	}
  }
}
