Altas bajas cambios y consultas
Publicado por Victor (2 intervenciones) el 09/01/2011 20:33:43
Este programa tiene 3 errores q not engo ni idea de como corregir
si alguien me puede dar una audadita se lo agradeceria
si alguien me puede dar una audadita se lo agradeceria
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
import java.util.*;
import java.io.*;
class MenuDiscos implements java.io.Serializable
{
public static void main (String args[])
{
int opcion=o;
int clav=o;
ArrayList <discos> punto = new ArrayList<discos> ();
discos aux=new discos () ;
try
{
ObjectInputStream in=new ObjectInputStream (new FileInpuutStream ("dato.dat"));
punto= (ArrayList <discos>)in.readObject ();
in.close () ;
}
catch (FileNotFoundException e)
{
System.out.println ("No hay base de datos. Se creara una nueva");
}
catch (Exception e)
{
e.printStackTrace () ;
}
do
{
System.out.println("BIENVENDIO AL PROGRAMA");
System.out.println("1.-ALTAS");
System.out.println("2.-BAJAS");
System.out.println("3.-CAMBIOS");
System.out.println("4.-CONSULTAS");
System.out.println("5.-SALIR");
System.out.println("Teclea una opcion");
opcion = Leer.datoInt() ;
while(opcion < 1 || opcion >5)
{
System.out.println("ERROR, TECLEA DE NUEVO");
opcion=Leer.datoInt ();
}
switch(opcion)
{
case 1 :
discos dis=new discos ();
char resp = 'S';
System.out.println("ALTAS") ;
While (resp == 'S');
{
dis.lee();
punto.add(dis);
System.out.printlm("Quieres agregar mas discos?S/N");
resp = Leer.datoChar();
}
System.out.printlm ("YA HAN SIDO DADOS DE ALTA TUS DISCO(S)");
break;
case 2 :
int resb = 0;
short borra = 0;
System.out.println ("BAJAS");
System.out.printlm("Teclea la clave del disco que quieres dar de baja");
resb = Leer.datoInt();
for(int i =0;i<punto.size();i++)
{
clav=punto.get(i).regcla();
if(resb == clav)
{
punto.remove(i);
System.out.println("El disco fue dado de baja");
borra=1;
}
}if(borra !=1)
{
System.out.println("La clave no existe");
}
break;
case 3 :
int resc = 0;
short cambio = 0;
System.out.println("Cambios");
System.out.println("Tecle la clave del disco que deseas MODIFICAR");
resc = Leer.datoInt ();
for (int i=0 ; i < punto.size(); i++)
{
clav=punto.get(i).regcla();
if(resc==clav)
{
System.out.println("Ingresa los nuevos datos");
aux.lee();
punto.set(i,aux);
Cambio=1;
System.out.println("Has realizado un cambio exitoso");
}
}
if (cambio != 1)
{
System.out.prinitln("La clave no existe");
}
break;
case 4:
int rec = 0;
short con= 0;
System.out.println("CONSULTAS");
System.out.println("Teclea la clave del disco consultar");
rec = Leer.datoInt();
for(int i = 0; i < punto.size(); i++)
{
clav=punto.get(i).regcla();
if(rec==clav)
{
System.out.println("Resultado de busqueda");
punto.get(i).despliega();
Con=1;
}
}
if(con ! = 1)
{
System.out.println("No existe");
}
break;
}
}
while (opcion!=5);
System.out.println("Adioss");
try
{
ObjectOutputStream out=new ObjectOutputStream(new FileOutputStream("dato.dat"));
out.writeObject(punto);
out.close();
}
catch (Exception e)
{
e.printStackTrace();
System.out.println("ERROR");
}
}
}
Valora esta pregunta


0