Afrai Posted June 25, 2014 Report Share Posted June 25, 2014 (edited) Buenas tardes gente de chile comparte. Bueno empesando tengo un problema con una tabla de datos que tengo que desarrollar para la universidad.Se trata de Array de datos una tabla 14 x 32 donde ingrese un documento y tiene que ser emitido con informacion completa dependiendo de el documento que se integre... public class Array1{public static void main( String[] args ){ int i; int j; //int w; definir cuando se necesario String[] Pieza={"A1","A2","B1","B2","C1","C2","D1","D2","E1","E2","F1","F2","G1","G2","H1","H2","I1","I2","J1","J2","K1","K2","V1","V2","W1","W2","X1","X2","Y1","Y2","Z1","Z2"}; //String[] Nombre_Modelo={"TC_240","TC_180"}; String a; double aux; String linea; In Mat=new In ("matrizgeo.txt"); double[][] Matrizgeo=new double[32][14]; while(!Mat.isEmpty()){ for(i=0;i<32;i++) { linea=Mat.readLine (); String[] separar = linea.split("\t"); for(j=0;j<14;j++) { a=separar [j]; aux=Double.parseDouble (a); Matrizgeo[j]=aux; } } } Mat.close(); StdOut.println("Matriz MatrizGeo"+"\t"+"\t"); StdOut.println("Piesas"+"\t"+"Oxicorte"+"\t"+"Plasma"+"\t"+"Soldadura"+"\t"+"Soldadura"+"\t"+"Torneado"+"\t"+"Torneado"+"\t"+"Fresado"+"\t"+"Fresado"+"\t"+"Taladrado"+"\t"+"Taladrado"+"\t"+"Taladrado"+"\t"+"Taladrado"+"\t"+"Fundicion"+"\t"+"Pintura"); StdOut.println("\t"+"\t"+"\t"+"Electrodo"+"\t"+"Mig"+"\t"+"Burdo"+"\t"+"Fino"+"\t"+"Burdo"+"\t"+"Fino"+"\t"+"11-20"+"\t"+"21-30"+"\t"+"31-60"+"\t"+"61-110"+"\t"+" "); for(i=0;i<32;i++) { StdOut.println(Pieza+"\t"+ Math.rint(Matrizgeo[0]) +"\t"+ Math.rint(Matrizgeo[1]) +"\t"+ Math.rint(Matrizgeo[2]) +"\t"+ Math.rint(Matrizgeo[3]) +"\t"+ Math.rint(Matrizgeo[4]) +"\t"+ Math.rint(Matrizgeo[5]) +"\t"+ Math.rint(Matrizgeo[6]) +"\t"+ Math.rint(Matrizgeo[7]) +"\t"+ Math.rint(Matrizgeo[8]) +"\t"+ Math.rint(Matrizgeo[9]) +"\t"+ Math.rint(Matrizgeo[10]) +"\t"+ Math.rint(Matrizgeo[11]) +"\t"+ Math.rint(Matrizgeo[12])+"\t"+Math.rint(Matrizgeo[13]) ); }}} Bueno, al ingresar los datos en DrJava todo bien, se imprimen pero todo queda en consola, ahora tengo que hacer que esa respuesta quede en un txt, entendi que era con un comando de ejecucion writer.write pero no entiendo como aplicarlo intente ya almenos 6 formas de internet y no tengo mas que null point ex... de ante mano gracias! Edited June 25, 2014 by Afrai Link to comment Share on other sites More sharing options...
Ra Posted June 25, 2014 Report Share Posted June 25, 2014 PrintWriter writer = new PrintWriter("the-file-name.txt", "UTF-8"); writer.println("Línea 1"); writer.println("Línea 2"); writer.close(); Suerte! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now