Ramirez Albarran Omar escom ipn 6SCV2

Site hosted by Angelfire.com: Build your free website today!

Clase para leer datos

package MisClases;
import java.awt.*;
import java.lang.*;
import javax.swing.*;
import java.io.*;

public class Getdat
{
Getdat(){}

public static String getCad()
{
String sdato="";
try
{
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader flujoE = new BufferedReader(isr);
sdato= flujoE.readLine();
}
catch (IOException e)
{
System.err.println("Error: "+ e.getMessage());
}
return sdato;
}

public static double getDou(){
String linea;
BufferedReader bufer;

try{
bufer =new BufferedReader(new InputStreamReader(System.in));
linea=bufer.readLine();
return Double.parseDouble(linea);
}
catch(NumberFormatException e){
System.out.println("No es double...");
//System.exit(1);
return 0;
}
catch(IOException e){return 0;}
}

public static int getInt(){
String linea;
BufferedReader bufer;

try{
bufer =new BufferedReader(new InputStreamReader(System.in));
linea=bufer.readLine();
return Integer.parseInt(linea);
}
catch(NumberFormatException e){
System.out.println("No es entero...");
//System.exit(1);
return 0;
}
catch(IOException e){return 0;}
}

public static float getFoat(){
String linea;
BufferedReader bufer;

try{
bufer =new BufferedReader(new InputStreamReader(System.in));
linea=bufer.readLine();
return Float.parseFloat(linea);
}
catch(NumberFormatException e){
System.out.println("No es flotante...");
//System.exit(1); www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps_p.html
return 0;
}
catch(IOException e){return 0;}

}

public static String getChar(){
String linea;
BufferedReader bufer;
try{
bufer =new BufferedReader(new InputStreamReader(System.in));
linea=bufer.readLine();
return linea;
}
catch(IOException e){
System.out.println("No es caracter...");
// System.exit(1);
return null;
}

}

}