como agregar un registro solo cuando lo indique en el menu y no todos de una
Publicado por pepe (15 intervenciones) el 05/05/2021 05:24:08
Buneo mi duda es esa yo declare un arreglo de 3 registros solo pero no quiero que se muestren los 3 de una si no 1 y se vuelva a abrir el menu y ya si vuelve a agregar otro y asi hasta tener 3 pero cuando le pongo en agregar se me muestran los 3 de una y asi no quiero :C miren les dejo mi codigo
hay mas pues pero es lo mismo nomas cambia el agregar a otro tipo pero es lo mismo no se que hacer :C
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
Trabajador_ADCS tra = new Trabajador_ADCS();
Trabajador_ADCS T[] = new Trabajador_ADCS[3];
Docente_ADCS Do = new Docente_ADCS();
Docente_ADCS D[] = new Docente_ADCS[3];
Administrativo_ADCS A = new Administrativo_ADCS();
Administrativo_ADCS Ad[] = new Administrativo_ADCS[3];
int opc;
do {
opc = Menu_ADCS.menu();
switch(opc)
{
case 1:
{
JOptionPane.showMessageDialog(null,"Agregar un Docente....");
for(i=0; i<D.length; i++)
{
nombre = JOptionPane.showInputDialog("Ingresa tu nombre");
domicilio = JOptionPane.showInputDialog("Ingresa tu domicilio");
edoCivil = JOptionPane.showInputDialog("Ingresa tu Estado Civil");
edad = Integer.parseInt(JOptionPane.showInputDialog("Ingresa tu edad"));
email = JOptionPane.showInputDialog("Ingresa tu Email");
carreraProf = JOptionPane.showInputDialog("Ingresa tu Carrera Profesional");
aniotitulacion = Double.parseDouble(JOptionPane.showInputDialog("Ingresa tu Año de titulacion"));
cedulaProf = Double.parseDouble(JOptionPane.showInputDialog("Ingresa tu cedula"));
D[i] = new Docente_ADCS(aniotitulacion,cedulaProf,edad,nombre,domicilio,carreraProf,edoCivil,email);
}
}break;
Valora esta pregunta


0