/**
*Class for simplified console input of all variable types .....
A short description : Getting console input in java is a very tedious process !
This java class will help you to input all types of variables from console with
relatively ease. All nine fundamental variable types are covered : byte, short,
int, long, float, double, char, String, and, boolean . It ignores appropriate input
errors smartly ( if ecc is set to true, the default is false ).It provides a simple
console output method also. Copy this file to your project/java directory and name it
console.java . Compile it using command like C:\java> javac console.java - and you are
all done. Please see the use of this class and input methods ( all static types -
ready to go !) in testconsole.java class example below, if you know little java -
it is walk in the park for you ! I wish you enjoy my effort, let me know through e-mail !!!
*
* @author (Shirshasin Ghosh Of Naihati, West Bengal, India... shirsha@rediffmail.com)
* @version ( 3.0 : 29-May-2004 : 9:10 P.M )
*/

/* Begin of Class */
import java.io.* ;

public class console {

/* Static public variables for console class */
public static int i , j ;
public static String hold = "" ;
public static char a ;
public static boolean checkecc = false ;

/* Set the ecc code to true of false */
public static void ecc( boolean set ) { checkecc = set ; }

/* Simple message display method */
public static void show( String prompt ) { System.out.print(prompt) ; }

/* Simple blank line showing method */
public static void showline( int n ) { for ( i = 1 ; i <= n ; i++) System.out.print("\n") ; }

/*** 1)Reads a number as string and returns Byte type ***/
public static byte getByte ( String prompt )
{
boolean validResponse = false; String str = ""; byte number = 0;
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
while(!validResponse) {
System.out.print(prompt) ;
try {
str = in.readLine(); if (checkecc) str = convertwhole(str) ;
number = Byte.parseByte(str); validResponse = true;
} /* End of try */
catch (Exception e) {
if(str.equals("uninitializedValue")) str = "";
System.out.println("Invalid Entry : "+e+"\n");
continue ;
} /* End of catch */
} /* End of While Loop */
return number;
} /* End of getByte Method */

/*** 2)Reads a number as string and returns short type ***/
public static short getShort(String prompt)
{
boolean validResponse = false; String str = ""; short number = 0;
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
while(!validResponse) {
System.out.print(prompt) ;
try {
str = in.readLine(); if (checkecc) str = convertwhole(str) ;
number = Short.parseShort(str); validResponse = true;
} /* End of try */
catch (Exception e) {
if(str.equals("uninitializedValue")) str = "";
System.out.println("Invalid Entry : "+e+"\n");
continue ;
} /* End of catch */
} /* End of While Loop */
return number;
} /* End of getShort Method */

/*** 3)Reads a number as string and returns int type ***/
public static int getInt(String prompt)
{
boolean validResponse = false; String str = ""; int number = 0;
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
while(!validResponse) {
System.out.print(prompt) ;
try {
str = in.readLine(); if (checkecc) str = convertwhole(str) ;
number = Integer.parseInt(str); validResponse = true;
} /* End of try */
catch (Exception e) {
if(str.equals("uninitializedValue")) str = "";
System.out.println("Invalid Entry : "+e+"\n");
continue ;
} /* End of catch */
} /* End of While Loop */
return number;
} /* End of getInt Method */

/*** 4)Reads a number as string and returns long type ***/
public static long getLong(String prompt)
{
boolean validResponse = false; String str = ""; long number = 0;
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
while(!validResponse) {
System.out.print(prompt) ;
try {
str = in.readLine(); if (checkecc) str = convertwhole(str) ;
number = Long.parseLong(str); validResponse = true;
} /* End of try */
catch (Exception e) {
if(str.equals("uninitializedValue")) str = "";
System.out.println("Invalid Entry : "+e+"\n");
continue ;
} /* End of catch */
} /* End of While Loop */
return number;
} /* End of getLong Method */

/*** 5)Reads a number as string and returns float type ***/
public static float getFloat(String prompt)
{
boolean validResponse = false; String str = ""; float number = 0;
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
while(!validResponse) {
System.out.print(prompt) ;
try {
str = in.readLine(); if (checkecc) str = convertwhole(str) ;
number = Float.parseFloat(str); validResponse = true;
} /* End of try */
catch (Exception e) {
if(str.equals("uninitializedValue")) str = "";
System.out.println("Invalid Entry : "+e+"\n");
continue ;
} /* End of catch */
} /* End of While Loop */
return number;
} /* End of getFloat Method */

/*** 6)Reads a number as string and returns double type ***/
public static double getDouble(String prompt)
{
boolean validResponse = false; String str = ""; double number = 0;
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
while(!validResponse) {
System.out.print(prompt) ;
try {
str = in.readLine(); if (checkecc) str = convertwhole(str) ;
number = Short.parseShort(str); validResponse = true;
} /* End of try */
catch (Exception e) {
if(str.equals("uninitializedValue")) str = "";
System.out.println("Invalid Entry : "+e+"\n");
continue ;
} /* End of catch */
} /* End of While Loop */
return number;
} /* End of getDouble Method */

/*** 7)Reads a character and returns a char ***/
public static char getChar(String prompt)
{
boolean validResponse = false; char nextChar = ' ' ;
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
while(!validResponse) {
System.out.print(prompt) ;
try {
nextChar = (char)in.read();
validResponse = true;
} /* End of try */
catch (Exception e) {
System.out.println("Invalid Entry : "+e+"\n");
continue ;
} /* End of catch */
} /* End of While Loop */
return nextChar ;
} /* End of getChar method */

/*** 8)Reads a string and returns that string ***/
public static String getString(String prompt)
{
boolean validResponse = false; String str = "";
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
while(!validResponse) {
System.out.print(prompt) ;
try {
str = in.readLine(); ;
validResponse = true;
} /* End of try */
catch (Exception e) {
if(str.equals("uninitializedValue")) str = "";
System.out.println("Invalid Entry : "+e+"\n");
continue ;
} /* End of catch */
} /* End of While Loop */
return str ;
} /* End of getString method */

/*** 9)Reads a string and returns boolean ***/
public static boolean getBoolean(String prompt)
{
boolean validResponse = false; String str = "";
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
while(!validResponse) {
System.out.print(prompt) ;
try {
str = in.readLine(); ;
validResponse = true;
} /* End of try */
catch (Exception e) {
if(str.equals("uninitializedValue")) str = "";
System.out.println("Invalid Entry : "+e+"\n");
continue ;
} /* End of catch */
} /* End of While Loop */

if ( str.equalsIgnoreCase("y") || str.equalsIgnoreCase("t") || str.equalsIgnoreCase("yes")
|| str.equalsIgnoreCase("true") || str.equalsIgnoreCase("1") ) return true ; else return false ;

} /* End of getBoolean Method */

/***** 10. A ECC-validate and triming/removing function *****/
public static String convertfrac (String str1)
{
int count = 0 ;
str1 = str1.trim();
hold="0" ; a=' '; i = str1.length() ;
for ( j = 0 ; j < i ; j++ ) {
a = str1.charAt(j) ; if ( a == '.' ) count++ ;
if (( ( a == '0' ) || ( a == '1') || ( a == '2' ) || ( a == '3') || ( a == '4') || ( a == '5' ) || ( a == '6') || ( a == '7') || ( a == '8' ) || ( a == '9')
|| ( a == '.') ) && ( count <= 1)) hold = hold + a ;
} return hold ;
} /* End of convertfrac method */


/***** 11. A ECC-validate and triming/removing function *****/
public static String convertwhole (String str1)
{
str1 = str1.trim();
i = str1.length() ; hold="0" ; a=' ';
for ( j = 0 ; j < i ; j++ ) {
a = str1.charAt(j) ;
if ( ( a == '0' ) || ( a == '1') || ( a == '2' ) || ( a == '3') || ( a == '4') || ( a == '5' ) || ( a == '6') || ( a == '7') || ( a == '8' ) || ( a == '9') )
hold = hold + a ; else if ( a == '.' ) return hold ;
} return hold ;
} /* End of convertwhole method */

/* A Handy method for testing prime numbers */
public static boolean isprime( long b )
{
long a, c ; byte k = 1 ;
a = Math.round( Math.sqrt(b) ) ;
for ( c = 2; c <= a ; c++ ) { if ((b % c) == 0 ) { k = 0 ; break ; } }
if (k == 1) return true ; else return false ;
} /* End of isprime method */

/* A handy method for giving spaces on a line */
public static void space ( int n)
{
int i ;
for ( i = 1 ;i <= n ; i++) System.out.print(" ");
} /* End of space method */


} /***** End of console class *****/

-------------------------------------------------------------------------------------------------------------------------------

/** The code of testconsole class, which uses the console.
class above and takes various variables inputs from the console,
happy programming
*
* @author (Shirshasin Ghosh Of Naihati, West Bengal, India... shirsha@rediffmail.com)
* @version ( 3.0 : 29-May-2004 : 9:10 P.M )
*/

public class testconsole
{

/* In BlueJ you can write here, public static void testinputs() */
public static void main(String args[])
{

byte b ; short s ; int i ; long l ; float f ;
double d ; char c ; boolean bln ; String strn ;

console.show("\nVarious data types will be inputed next lines...\n" ) ;

bln = console.getBoolean("Dou you want the ECC code to be turned on ? y - yes, n - no : ");
if (bln) console.ecc(true); else console.ecc(false) ;

b = console.getByte("Please enter a byte number.....");

s = console.getShort("Please enter a short number...") ;

i = console.getInt("Please enter an integer...");

l = console.getLong("Please enter a long integer...") ;
if ( console.isprime(l)) console.show("Do you know "+l+" is also a Prime Number...!\n");

f = console.getFloat("Please enter a floating point number...") ;

d = console.getDouble("Please enter double precision number...") ;

c = console.getChar("Please enter a single character...") ;

strn = console.getString("Please enter a String, or a Word...") ;

bln = console.getBoolean("Please enter a boolean... t or f , y or n...") ;

console.show("\n\n You have entered : Byte = "+b+" : Short = "+s+" : Integer = "+i+" : Long = "
+l+"\n : Float = "+f+" : Double = "+d+" : Char = "+c+" : String = "+strn+" : Boolean = "+bln+"\n");

System.exit(1);
}
} /* End of testconsole.class */

---------------------------------------------------------------------------------------------------------------------------
/**
*Class for simplified gui dialog input of all variable types .....
A short description : Getting gui dialog input in java is a very tedious process !
This java class will help you to input all types of variables from gui dialog with
relatively ease. All nine fundamental variable types are covered : byte, short,
int, long, float, double, char, String, and, boolean . It ignores appropriate input
errors smartly ( if ecc is set to true, the default is false ). Copy this file to
your project/java directory and name it console.java . Compile it using command like
C:\java> javac dialog .java - and you are all done. It provides a simple gui dialog
output method also. Please see the use of this class and input methods (all static types
- ready to go !) in testdialog.java classs example below, if you know little java -
it is walk in the park for you ! I wish you enjoy my effort, let me know through e-mail !!!
*
* @author (Shirshasin Ghosh Of Naihati, West Bengal, India... shirsha@rediffmail.com)
* @version ( 3.0 : 29-May-2004 : 9:10 P.M )
*/

/* Begin of Class */

import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.JDialog;
import javax.swing.JButton;
import java.awt.event.*;

public class dialog {

/*** static instance variables ***/
static final String STRING_TITLE = "Enter a String";
static final String CHAR_TITLE = "Enter a charecter";
static final String INT_TITLE = "Enter an integer number";
static final String BOOLEAN_TITLE = "Select True or False / Yes or No";
static final String FLOAT_TITLE = "Enter a floating point number";
static final String TRUE = "True";
static final String FALSE = "False";
static final String EMPTY_STRING = "";
public static boolean checkecc = false ;
public static int i , j ;
public static String hold = "" ;
public static char a ;

/*** Set the ecc code to true of false ***/
public static void ecc( boolean get ) { checkecc = get ; }

/*** Simple message display method ***/
public static void show( String prompt ) { JOptionPane.showMessageDialog(null, prompt) ; }

/* show method overloaded for heading */
public static void show( String prompt, String heading )
{ JOptionPane.showMessageDialog(null, prompt, heading, JOptionPane.INFORMATION_MESSAGE) ; }

/* 1. input a byte number */
public static byte getByte(String prompt)
{
Object[] commentArray = {prompt, EMPTY_STRING, EMPTY_STRING};
Object[] options = { "OK" };

String inputValue = "";
boolean validResponse = false;
byte response = 0;
while(!validResponse)
{
final JOptionPane optionPane = new JOptionPane(commentArray,
JOptionPane.QUESTION_MESSAGE,
JOptionPane.OK_CANCEL_OPTION,
null,
options,
options[0]);

optionPane.setWantsInput(true);
JDialog dialog = optionPane.createDialog(null, "Enter a Byte number");

dialog.pack();
dialog.show();

String result = (String)optionPane.getInputValue();
if ( checkecc ) result = convertwhole(result) ;
try
{
response = Byte.parseByte(result);
validResponse = true;
}
catch(NumberFormatException exception)
{
if(result.equals("uninitializedValue"))
result = "";
commentArray[1] = "Invalid byte: " + result;
commentArray[2] = "Enter a valid byte";
}
}
return response;
} /* End of getByte method */


/*2. input a short number */
public static short getShort(String prompt)
{
Object[] commentArray = {prompt, EMPTY_STRING, EMPTY_STRING};
Object[] options = { "OK" };

String inputValue = "";
boolean validResponse = false;
short response = 0;
while(!validResponse)
{
final JOptionPane optionPane = new JOptionPane(commentArray,
JOptionPane.QUESTION_MESSAGE,
JOptionPane.OK_CANCEL_OPTION,
null,
options,
options[0]);

optionPane.setWantsInput(true);
JDialog dialog = optionPane.createDialog(null, "Enter a short number");

dialog.pack();
dialog.show();

String result = (String)optionPane.getInputValue();
if ( checkecc ) result = convertwhole(result) ;
try
{
response = Short.parseShort(result);
validResponse = true;
}
catch(NumberFormatException exception)
{
if(result.equals("uninitializedValue"))
result = "";
commentArray[1] = "Invalid short: " + result;
commentArray[2] = "Enter a valid short";
}
}
return response;
} /* End of getShort method */


/*** 3. Input a integer ***/
public static int getInt(String prompt)
{
Object[] commentArray = {prompt, EMPTY_STRING, EMPTY_STRING};
Object[] options = { "OK" };

String inputValue = "";
boolean validResponse = false;
int response = 0;
while(!validResponse)
{
final JOptionPane optionPane = new JOptionPane(commentArray,
JOptionPane.QUESTION_MESSAGE,
JOptionPane.OK_CANCEL_OPTION,
null,
options,
options[0]);

optionPane.setWantsInput(true);
JDialog dialog = optionPane.createDialog(null, INT_TITLE);

dialog.pack();
dialog.show();

String result = (String)optionPane.getInputValue();
if ( checkecc ) result = convertwhole(result) ;
try
{
response = Integer.parseInt(result);
validResponse = true;
}
catch(NumberFormatException exception)
{
if(result.equals("uninitializedValue"))
result = "";
commentArray[1] = "Invalid int: " + result;
commentArray[2] = "Enter a valid integer";
}
}
return response;
} /* End of getInt method */


/**4. input a long number **/
public static long getLong(String prompt)
{
Object[] commentArray = {prompt, EMPTY_STRING, EMPTY_STRING};
Object[] options = { "OK" };

String inputValue = "";
boolean validResponse = false;
long response = 0;
while(!validResponse)
{
final JOptionPane optionPane = new JOptionPane(commentArray,
JOptionPane.QUESTION_MESSAGE,
JOptionPane.OK_CANCEL_OPTION,
null,
options,
options[0]);

optionPane.setWantsInput(true);
JDialog dialog = optionPane.createDialog(null, "Enter a long number");

dialog.pack();
dialog.show();

String result = (String)optionPane.getInputValue();
if ( checkecc ) result = convertwhole(result) ;
try
{
response = Long.parseLong(result);
validResponse = true;
}
catch(NumberFormatException exception)
{
if(result.equals("uninitializedValue"))
result = "";
commentArray[1] = "Invalid long : " + result;
commentArray[2] = "Enter a valid long";
}
}
return response;
} /* End of getLong method */


/*** 5. Input a Float ***/
public static float getFloat(String prompt)
{
Object[] options = { "OK" };
Object[] commentArray = {prompt, EMPTY_STRING, EMPTY_STRING};

String inputValue = "";
boolean validResponse = false;

float response = 0.0f;

while(!validResponse)
{
final JOptionPane optionPane = new JOptionPane(commentArray,
JOptionPane.QUESTION_MESSAGE,
JOptionPane.OK_CANCEL_OPTION,
null,
options,
options[0]);

optionPane.setWantsInput(true);
JDialog dialog = optionPane.createDialog(null, FLOAT_TITLE);

dialog.pack();
dialog.show();

String result = (String)optionPane.getInputValue();
if ( checkecc ) result = convertfrac(result) ;
try
{
response = Float.valueOf(result).floatValue();
validResponse = true;
}
catch(NumberFormatException exception)
{
commentArray[1] = "Invalid float: " + result;
commentArray[2] = "Enter a valid float";
inputValue = result;
}
}
return response;
} /* End of getFloat method */


/***6. input a double ***/
public static double getDouble(String prompt)
{
Object[] commentArray = {prompt, EMPTY_STRING, EMPTY_STRING};
Object[] options = { "OK" };

String inputValue = "";
boolean validResponse = false;
double response = 0;
while(!validResponse)
{
final JOptionPane optionPane = new JOptionPane(commentArray,
JOptionPane.QUESTION_MESSAGE,
JOptionPane.OK_CANCEL_OPTION,
null,
options,
options[0]);

optionPane.setWantsInput(true);
JDialog dialog = optionPane.createDialog(null, "Enter a double precision number");

dialog.pack();
dialog.show();

String result = (String)optionPane.getInputValue();
if ( checkecc ) result = convertfrac(result) ;
try
{
response = Double.parseDouble(result);
validResponse = true;
}
catch(NumberFormatException exception)
{
if(result.equals("uninitializedValue"))
result = "";
commentArray[1] = "Invalid double : " + result;
commentArray[2] = "Enter a valid double";
}
}
return response;
} /* End of getDouble method */


/*** 7. Input a char ***/
public static char getChar(String prompt)
{
char response ='-';

String result = null;

Object[] commentArray = {prompt, EMPTY_STRING, EMPTY_STRING};
Object[] options = { "OK" };

String inputValue = "";
boolean validResponse = false;

while(!validResponse)
{
final JOptionPane optionPane = new JOptionPane(commentArray,
JOptionPane.QUESTION_MESSAGE,
JOptionPane.OK_CANCEL_OPTION,
null,
options,
options[0]);

optionPane.setWantsInput(true);
JDialog dialog = optionPane.createDialog(null, CHAR_TITLE);

dialog.pack();
dialog.show();

Object input = optionPane.getInputValue();
if(input != JOptionPane.UNINITIALIZED_VALUE)
{
result = (String)input;
if(result != null && result.length() == 1)
{
response = result.charAt(0);
validResponse = true;
}
else
{
commentArray[1] = "Invalid entry : " + result;
commentArray[2] = "Enter a single character";
}
}
else
{
commentArray[1] = "Invalid entry : " + result;
commentArray[2] = "Enter a single character";
}
}
return response;
} /* End of getChar method */

/*** 8. Input a String ***/
public static String getString(String prompt)
{
Object[] commentArray = {prompt, EMPTY_STRING, EMPTY_STRING};
Object[] options = { "OK" };

String inputValue = "";
boolean validResponse = false;

String result = null;

while(!validResponse)
{
final JOptionPane optionPane = new JOptionPane(commentArray,
JOptionPane.QUESTION_MESSAGE,
JOptionPane.OK_CANCEL_OPTION,
null,
options,
options[0]);

optionPane.setWantsInput(true);
JDialog dialog = optionPane.createDialog(null, STRING_TITLE);

dialog.pack();
dialog.show();

Object response = optionPane.getInputValue();

if(response != JOptionPane.UNINITIALIZED_VALUE)
{
result = (String)response;
validResponse = true;
}
else
{
commentArray[1] = "Invalid entry : " + result;
commentArray[2] = "Enter a valid String";
}
}
return result;
} /* End of getString method */

/*** 9. Input a Boolean ***/
public static boolean getBoolean(String prompt, String trueText, String falseText)
{
Object[] commentArray = {prompt, EMPTY_STRING};
boolean validResponse = false;
int result = -1;

while(!validResponse)
{
Object[] options = {trueText, falseText};
result = JOptionPane.showOptionDialog(null,
commentArray,
BOOLEAN_TITLE,
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null, //don't use a custom Icon
options, //the titles of buttons
TRUE ); //the title of the default button

// check true or false buttons pressed
if(result == 0 || result == 1)
validResponse = true;
else
commentArray[1] = "Incorrect selection : Choose true or false buttons";
}
return (result == 0);
} /* End of getBoolean mehod */

/* overloading getBoolean method */
public static boolean getBoolean(String prompt)
{
return getBoolean(prompt, TRUE, FALSE);
} /* end of overloaded getBoolean method */


/* 10. A ECC-validate and trimming/removing functions is giving below ***/
public static String convertfrac (String str1)
{
int count = 0 ;
str1 = str1.trim() ; hold="0" ; a=' '; i = str1.length() ;
for ( j = 0 ; j < i ; j++ ) {
a = str1.charAt(j) ; if ( a == '.' ) count++ ;
if (( ( a == '0' ) || ( a == '1') || ( a == '2' ) || ( a == '3') || ( a == '4') || ( a == '5' ) || ( a == '6') || ( a == '7') || ( a == '8' ) || ( a == '9')
|| ( a == '.') ) && ( count <= 1)) hold = hold + a ;
}
return hold ;
} /* End of convertfrac method */

/* 11. Another ECC-validate and trimming/removing functions is giving below ***/
public static String convertwhole (String str1)
{
str1 = str1.trim() ;
i = str1.length() ; hold="0" ; a=' ';
for ( j = 0 ; j < i ; j++ ) {
a = str1.charAt(j) ;
if ( ( a == '0' ) || ( a == '1') || ( a == '2' ) || ( a == '3') || ( a == '4') || ( a == '5' ) || ( a == '6') || ( a == '7') || ( a == '8' ) || ( a == '9') )
hold = hold + a ; else if ( a == '.' ) return hold ;
}
return hold ;
} /* End of convertwhole method */

/* A Handy method for testing prime numbers */
public static boolean isprime( long b )
{
long a, c; byte k = 1 ;
a = Math.round( Math.sqrt(b) ) ;
for ( c = 2; c <= a ; c++ ) { if ((b % c) == 0 ) { k = 0 ; break ; } }
if (k == 1) return true ; else return false ;
} /* End of isprime method */

/* A handy method for giving spaces on a line */
public static void space ( int n )
{
int i ;
for ( i = 1 ;i <= n ; i++) System.out.print(" ");
} /* End of space method */


} /* End of dialog class */

------------------------------------------------------------------------------------------------------------------------

/** The code of testdialog class, which uses the dialog.class above and takes various variables inputs from the console,
happy programming !
*
* @author (Shirshasin Ghosh Of Naihati, West Bengal, India... shirsha@rediffmail.com)
* @version ( 3.0 : 29-May-2004 : 9:10 P.M )
*/


public class testdialog
{

/* In BlueJ you can write here, public static void testinputs() */
public static void main(String args[])
{

byte b ; short s ; int i ; long l ; float f ;
double d ; char c ; boolean bln ; String strn ;

dialog.show("This is a sample Message..With custom heading", "It is its heading !!!");

dialog.show("This is also a sample Message..With default heading");

bln = dialog.getBoolean("Various data types will be inputted next dialog boxes.\nDo you want ECC to be turned on ?", "Yes - Please", "No - Thanks" ) ;
if (bln) dialog.ecc(true) ; else dialog.ecc(false) ;

b = dialog.getByte("Please enter a byte number...");

s = dialog.getShort("Please enter a short number...") ;

i = dialog.getInt("Please enter an integer...");

l = dialog.getLong("Please enter a long integer...") ;
if ( dialog.isprime(l)) dialog.show("Do you know "+l+" is also a Prime Number...!");


f = dialog.getFloat("Please enter a floating point number...") ;

d = dialog.getDouble("Please enter double precision number...") ;

c = dialog.getChar("Please enter a single charecter...") ;

strn = dialog.getString("Please enter a String, or a Word...") ;

bln = dialog.getBoolean("Please enter a boolean... t or f , y or n...") ;

dialog.show("\nYou have entered : Byte = "+b+" : Short = "+s+" : Integer = "+i+" : Long = "
+l+"\n : Float = "+f+" : Double = "+d+" : Char = "+c+" : String = "+strn+" : Boolean = "+bln);

System.exit(1);
}
} /* End of testdialog class */