ayuda codigo
Publicado por david (2 intervenciones) el 22/05/2012 02:58:42
ayuda quiero mostrar los comercios en pantalla pro no se como ubicarme urgente les envio mi codigo gracias
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import java.io.*;
import javax.swing.JOptionPane;
/**
*
* @author luis padron
*/
public class JavaApplication5 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
// TODO code application logic
atributicos[] atri;
atri = new atributicos[5];
String[] valores = null;
FileReader LectorArchivo;
try{
LectorArchivo = new FileReader ("C:/Users/luis padron/Documents/NetBeansProjects/nombre/proyecto.txt");
}catch(FileNotFoundException err){
JOptionPane.showConfirmDialog(null, "archivo no encontrado \n" + err.getMessage());
return;
}
BufferedReader textoArchivo;
textoArchivo = new BufferedReader (LectorArchivo);
int casilla;
casilla = 0;
while (casilla < atri.length) {
String lineaTexto;
try{
lineaTexto = textoArchivo.readLine();
}catch(IOException err){
JOptionPane.showMessageDialog(null, err.getMessage());
return;
}
if (lineaTexto == null) {
break;
}
if (lineaTexto.equals("")) {
break;
}
valores = lineaTexto.split(";");
int i = 0;
atri[casilla] = new atributicos();
atri[casilla].setNombre(valores[i+0]);
atri[casilla].setEstado(valores[i+1]);
atri[casilla].setRif(valores[i+2]);
atri[casilla].setDireccion(valores[i+3]);
atri[casilla].setTelefono(valores[i+4]);
atri[casilla].setPag_web(valores[i+5]);
atri[casilla].setCorreo(valores[i+6]);
atri[casilla].setTags(valores[i+7]);
casilla++;
}
String mostrar;
mostrar = "" ;
casilla = 0;
while( casilla < atri.length ){
if(atri[casilla] != null) {
mostrar = mostrar + atri[casilla].getNombre() + "\n" + atri[casilla].getEstado() +
" " + atri[casilla].getDireccion() + " " + atri[casilla].getTelefono() +
" " + atri[casilla].getPag_web() + " " + atri[casilla].getCorreo() +
" " + atri[casilla].getTags() +"\n";
}
casilla++;
}
System.out.println(mostrar);
String leer;
System.out.println("elija su comercio a buscar");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
leer = br.readLine();
boolean j;
j = false;
int i;
for (i=0; i<valores[i].length(); i++)
if (valores[i].equals(leer) ) {
j= true;
}
System.out.println(valores[i]);
}
}
Valora esta pregunta


0