Mostrar Mensajes

Esta sección te permite ver todos los posts escritos por este usuario. Ten en cuenta que sólo puedes ver los posts escritos en zonas a las que tienes acceso en este momento.


Mensajes - China

Páginas: [1] 2
1
Hice esto pero lo que hace es agrega una linea nuevapero lo que quiero es que me modifique la misma linea pero no se como pasarlos,  listaes un arraylist que tiene una clase llamada banco esa clase contiene get y set este es el codigo que tengo
Código: [Seleccionar]

                 
                 BufferedWriter bw = null;
       try {
           bw = new BufferedWriter(new FileWriter(archivo, true));
           
           
           Banco b = new Banco(ncuenta,tcuenta,cliente,banco,saldo);
           for (int i = 0; i < lista.size(); i++) {
               
               if(jTextField1.getText().equals(lista.get(i).getNcuenta())){
                 
           
                   lista.get(i).setTcuenta(jComboBox1.getSelectedItem().toString());
                   lista.get(i).setCliente(jTextField2.getText());
                   lista.get(i).setBanco(jComboBox2.getSelectedItem().toString());
                   lista.get(i).setSaldo(jTextField3.getText());
             
                  bw.write(b.toString());
                  bw.newLine();
                 
               }
               
           } 
           // para limpiar lo que tiene los jtexfield entre otros
           jTextField1.setText("");
           jComboBox1.setSelectedItem("");
           jTextField2.setText("");
           jComboBox2.setSelectedItem("");
           jTextField3.setText("");
           
//Este es para que lo muestre en la tabla
           String matriz [][]= new String [lista.size()][5];
           for(int i = 0; i < lista.size(); i++){
               
               matriz[i][0] = lista.get(i).getNcuenta();
               matriz[i][1] = lista.get(i).getTcuenta();
               matriz[i][2] = lista.get(i).getCliente();
               matriz[i][3] = lista.get(i).getBanco();
               matriz[i][4] = lista.get(i).getSaldo();
           }      jTable1.setModel(new javax.swing.table.DefaultTableModel(
                   matriz,
                   new String [] {
                       "No.Cuenta", "Tipo de cuenta", "Cliente", "Banco", "Saldo"
                           
                   }
                   
           ));
         
            bw.close();
       } catch (IOException ex) {
           Logger.getLogger(FormularioBanco.class.getName()).log(Level.SEVERE, null, ex);
       }
       

2
Buenas Noches tengo una problema con la lectura de archivo, tengo un metodo llamado lectura el cual estoy un archivo que tiene como separador "|", pero los datos los guardo mediante una matriz

Código: [Seleccionar]
public void Lectura() {

        String Linea;

        try {

            FileReader fr = new FileReader("C:\\Proyecto\\Banco.txt");
            BufferedReader br = new BufferedReader(fr);

            String matriz[][] = new String[lista.size()][5];
            int numlineas = 0;
            while (((Linea = br.readLine()) != null)) {
               
               
                String a[] = Linea.split("|");

                for (int i = 0; i < lista.size(); i++) {

                    matriz[numlineas][i] = a[i];

                }

                Linea = br.readLine();
                br.close();
            }
        }catch(Exception e){
            JOptionPane.showMessageDialog(null,e);
        }
Este metodo se lo paso a un evento tipo botón en si lo que quiero es que a momento de hacer mi operacion se modifique tanto en la tabla y el archivo, en la tabla si se modifica pero mi archivo no se modifica el saldo, Espero me puedan ayudar

4
Ya chque que hace que no lo haga mi listado ese que no lo encuentre no se en que afectara porque hago otra funciones y si lo hagarra pero selecciono listado y ya sale ese error
Código: [Seleccionar]
public void setListado()
   {
            try {
                   //FileReader fr = new FileReader("C:\\Proyecto\\EquipoV.txt");
                   
                   BufferedReader bf = new BufferedReader(new FileReader(archivo));
                   String cad;
                   String cad2="";
                   while ((cad = bf.readLine()) != null){
                         cad2= cad2+cad+"\n";
                   }
                   JOptionPane.showMessageDialog(null,cad2);
              } catch (Exception ex) {
                JOptionPane.showMessageDialog(null,"Se generó una excepción.");
                ex.printStackTrace(System.err);
              }
        }
Este es mi codigo de listado

5
El modificar ya lo arregle pero la eliminacion me trae un problemita de que por ejemplo hago otras funciones como agregar lo hago y me voy a eliminar le doy la clave a elimnar y todo eso le doy si y me arroja en mensaje no se encontro el archivo tal pero me salgo y lo vuevo a ejecutar y hago los pasos procedientes y si lo elimina pero sin hacer alguna otra funcion ¿A que se debe eso? y esta tal cual me lo indicaste

6
Todo como tu lo mencionas esta tal cual lo unico que cambie fue el telefono ya que le estoy pasando un cachado de errores con matches no se si eso me este perjudicando, me sigue haceindo lo mismo por ejemplo ingreso los datos y cuando quiero modificar de don la clave cual quiero modificar le digo que si pero despues se sale y me manda el error de java. lang y todo lo demas igual me pasa con eliminar que quiero elimnar y pongo la clave a eliminar y me sale no se guardaron los cambios y para que pueda hacerlo tengo que salir y volver a ejecutar y ya lo elimina no sabria e porque hace eso

7
Hola que tal de nuevo estaba haceindo el metodo de modificar con tu me lo habias explicado pero al momento de darle que si al modificar me parace este error
Código: [Seleccionar]
java.lang.NullPointerException
at java.io.Writer.write(Writer.java:157)
at CrearFile2.setModificar(CrearFile2.java:237)
at MenuV2.setMenuV2(MenuV2.java:50)
at MenuBueno.main(MenuBueno.java:12)

y despues se sale y me borra todo lo que tengo en el archivo no entiendo el porque ya revise todo y no le encuentro el error

Código: [Seleccionar]
import java.io.*;
import javax.swing.JOptionPane;
import java.util.*;

public class Modificar {
 
  public Modificar()
  {}

File archivo= new File("C:\\Prueba\\EquipoV.txt");
LeerMostrar5 lm5 = new LeerMostrar5();
   
  public void setModificar()
   {
      if (archivo.exists())
      {
         String clave = JOptionPane.showInputDialog("Dame clave a modificar");
         try {
            ArrayList<String> lineas = new ArrayList<>();
            BufferedReader br = new BufferedReader(new FileReader(archivo));
            String linea = br.readLine();
            while (linea != null)
            {
               if (linea.startsWith(clave))
               {
                  int confirmar = JOptionPane.showConfirmDialog(null, "Se ha encontrado:\n"
                        + linea + "\n¿Seguro que quiere modificar?", "Confirmar Modificacion", JOptionPane.YES_NO_OPTION);
                  if (confirmar == JOptionPane.YES_OPTION)
                  {
                     lineas.add(getLineaModificada(linea));
                  }
                  else//No quiere modificar
                     lineas.add(linea);
               }
               else//Linea no coincide con clave
                  lineas.add(linea);
               
               linea = br.readLine();
            }
            br.close();
            //Guarda los cambios en el archivo.
            if (archivo.delete())
            {
               BufferedWriter bw = new BufferedWriter(new FileWriter(archivo, true));
               for (String line: lineas)
               {
                  bw.write(line);
                  bw.newLine();
               }
               bw.close();
               JOptionPane.showMessageDialog(null, "Los cambios se han guardado");
            }
            else//Este en caso de no poder modificar
            {
               JOptionPane.showMessageDialog(null, "No se ha podido modificar el archivo: " + archivo.getAbsolutePath());
            }

         }catch(Exception e) {
            e.printStackTrace();
            JOptionPane.showMessageDialog(null, e.getLocalizedMessage());
         }
      }
      else//No existe archivo
         JOptionPane.showMessageDialog(null, "No existe fichero: " + archivo.getAbsolutePath());
   }
   
   private String getLineaModificada(String linea)
{
String lineaModificada = null;//Esta linea devuelve las modificaciones

if (linea.endsWith("Jugador"))//La linea pertenece a la clase Jugadores
{
String[] datosJugador = linea.split("\\|");
//Construimos un Jugador con los datos obtenidos
Jugadores jugador = new Jugadores();
jugador.setMatricula(Integer.parseInt(datosJugador[0]));
jugador.setNombre(datosJugador[1]);
jugador.setAp(datosJugador[2]);
jugador.setAm(datosJugador[3]);
jugador.setNumeroCa(Integer.parseInt(datosJugador[4]));
jugador.setPosicion(datosJugador[5]);
jugador.setEstatus(datosJugador[6]);
jugador.setSexo(datosJugador[7]);

       //Preguntamos por matricula
int respuesta = JOptionPane.showConfirmDialog(null, "Matricula Actual:\n" + jugador.getMatricula() + "\n¿Modificar?",
"Modificar Jugador", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)//SÍ quiere modificar
jugador.setMatricula(lm5.getMatricula2());

//Preguntamos por nombre
respuesta = JOptionPane.showConfirmDialog(null, "Nombre Actual:\n" + jugador.getNombre() + "\n¿Modificar?",
"Modificar Jugador", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
jugador.setNombre(lm5.getNombreJ());

//Apellido Paterno
respuesta = JOptionPane.showConfirmDialog(null, "Apellido Paterno Actual:\n" + jugador.getAp() + "\n¿Modificar?",
"Modificar Jugador", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
jugador.setAp(lm5.getApe());

//Apellido Materno
respuesta = JOptionPane.showConfirmDialog(null, "Apellido Materno Actual:\n" + jugador.getAm() + "\n¿Modificar?",
"Modificar Jugador", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
jugador.setAm(lm5.getAma());

//Numero Camiseta
respuesta = JOptionPane.showConfirmDialog(null, "Numero Camiseta Actual:\n" + jugador.getNumeroCa() + "\n¿Modificar?",
"Modificar Jugador", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
jugador.setNumeroCa(lm5.getNumC());

//Posicion
respuesta = JOptionPane.showConfirmDialog(null, "Posicion Actual:\n" + jugador.getPosicion() + "\n¿Modificar?",
"Modificar Jugador", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
jugador.setPosicion(lm5.getPosic());

//Status
respuesta = JOptionPane.showConfirmDialog(null, "Estado Actual:\n" + jugador.getEstatus() + "\n¿Modificar?",
"Modificar Jugador", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
jugador.setEstatus(lm5.getEstatus1());

//Sexo
respuesta = JOptionPane.showConfirmDialog(null, "Sexo Actual:\n" + jugador.getSexo() + "\n¿Modificar?",
"Modificar Jugador", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
jugador.setSexo(lm5.getSex1());


        lineaModificada = jugador.toString();
}
else if (linea.endsWith("Personal"))//La linea pertenece a la clase Personal
{
   String[] datosPersonal = linea.split("\\|");

Personal p = new Personal();
p.setClave(Integer.parseInt(datosPersonal[0]));
p.setNombre(datosPersonal[1]);
p.setAp(datosPersonal[2]);
p.setAm(datosPersonal[3]);
p.setPuesto(datosPersonal[4]);
p.setEspecialidad(datosPersonal[5]);
p.setTiempoE(Integer.parseInt(datosPersonal[6]));
p.setSexo(datosPersonal[7]);

         
int respuesta = JOptionPane.showConfirmDialog(null, "Clave Actual:\n" + p.getClave() + "\n¿Modificar?",
"Modificar Personal", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)//SÍ quiere modificar
p.setClave(lm5.getClave());

//Preguntamos por nombre
respuesta = JOptionPane.showConfirmDialog(null, "Nombre Actual:\n" + p.getNombre() + "\n¿Modificar?",
"Modificar Personal", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
p.setNombre(lm5.getNombrep());

//Apellido Paterno
respuesta = JOptionPane.showConfirmDialog(null, "Apellido Paterno Actual:\n" + p.getAp() + "\n¿Modificar?",
"Modificar Personal", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
p.setAp(lm5.getAp2());

//Apellido Materno
respuesta = JOptionPane.showConfirmDialog(null, "Apellido Materno Actual:\n" + p.getAm() + "\n¿Modificar?",
"Modificar Personal", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
p.setAm(lm5.getAm2());

//Puesto
respuesta = JOptionPane.showConfirmDialog(null, "Puesto Actual:\n" + p.getPuesto() + "\n¿Modificar?",
"Modificar Personal", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
p.setPuesto(lm5.getPuesto1());

//Especialidad
respuesta = JOptionPane.showConfirmDialog(null, "Especialidad Actual:\n" + p.getEspecialidad() + "\n¿Modificar?",
"Modificar Personal", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
p.setEspecialidad(lm5.getEsp());

//Tiempo en la empresa
respuesta = JOptionPane.showConfirmDialog(null, "Estado Actual:\n" + p.getTiempoE() + "\n¿Modificar?",
"Modificar Personal", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
p.setTiempoE(lm5.getTiempoe());

//Sexo
respuesta = JOptionPane.showConfirmDialog(null, "Sexo Actual:\n" + p.getSexo() + "\n¿Modificar?",
"Modificar Personal", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
p.setSexo(lm5.getSex2());

lineaModificada = p.toString();
}
else if (linea.endsWith("Proveedor"))//La linea pertenece a la clase Proveedores
{
String[] datosProveedores = linea.split("\\|");

Proovedores pr = new Proovedores();
pr.setNombre(datosProveedores[0]);
pr.setDireccion(datosProveedores[1]);
pr.setCiudad(datosProveedores[2]);
pr.setEmail(datosProveedores[3]);
pr.setTelefono(datosProveedores[4]);

        //Preguntamos por Nombre
int respuesta = JOptionPane.showConfirmDialog(null, "Nombre Actual:\n" + pr.getNombre() + "\n¿Modificar?",
"Modificar Personal", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)//SÍ quiere modificar
pr.setNombre(lm5.getNombrePr());

//Direccion
respuesta = JOptionPane.showConfirmDialog(null, "Direccion Actual:\n" + pr.getDireccion() + "\n¿Modificar?",
"Modificar Proveedores", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
pr.setDireccion(lm5.getDirecpr());

//Ciudad
respuesta = JOptionPane.showConfirmDialog(null, "Ciudad Actual:\n" + pr.getCiudad() + "\n¿Modificar?",
"Modificar Proveedores", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
pr.setCiudad(lm5.getCiudad1());

//Email
respuesta = JOptionPane.showConfirmDialog(null, "Email Actual:\n" + pr.getEmail() + "\n¿Modificar?",
"Modificar Proveedores", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
pr.setEmail(lm5.getEmail());

//Telefono
respuesta = JOptionPane.showConfirmDialog(null, "Telefono Actual:\n" + pr.getTelefono() + "\n¿Modificar?",
"Modificar Proveedores", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
pr.setTelefono(lm5.getTelefono());

lineaModificada = pr.toString();
}

return lineaModificada;//Finalizado el metodo, esta linea contendrá los datos de un Jugador, o un Proveedor o un Personal
}
  }


8
Ya me salio el metodo modiicar pero me surgio un problema es que necesito agregar la lectra de archivos para poder hacer mi listado de todo loque tengo pero realmente nose como implemntarlo ¿tengo que moficarto todo el codigo?
al moemnto de consultar me aparece todo con todo los pipes ejemplo:

12|Jorge|Perez|Sanchez|Entrenador|Doctor|25|Masculino|Personal

y lo que yo quiero es que mestre esto
clave: 12
nombre: jorge.... y asi sucesivamente pero creo que tengo que hacer lectura de todos mis datos como lo puedo implementar

9
Hola que tal de nuevo estaba haceindo el metodo de modificar con tu me lo habias explicado pero al momento de darle que si al modificar me parace este error
Código: [Seleccionar]
java.lang.NullPointerException
at java.io.Writer.write(Writer.java:157)
at CrearFile2.setModificar(CrearFile2.java:237)
at MenuV2.setMenuV2(MenuV2.java:50)
at MenuBueno.main(MenuBueno.java:12)

y no me es posible modificar nada por que enseguida sale y lo hice tal cual me lo marcaste
Código: [Seleccionar]
private String getLineaModificada(String linea)
{
String lineaModificada = null;//Esta será la linea que vamos a devolver con las modificaciones

if (linea.endsWith("Jugador"))//La linea pertenece a la clase Jugadores
{
String[] datosJugador = linea.split("\\|");
//Construimos un Jugador con los datos obtenidos
Jugadores jugador = new Jugadores();
jugador.setMatricula(Integer.parseInt(datosJugador[0]));
jugador.setNombre(datosJugador[1]);
jugador.setAp(datosJugador[2]);
jugador.setAm(datosJugador[3]);
jugador.setNumeroCa(Integer.parseInt(datosJugador[4]));
jugador.setPosicion(datosJugador[5]);
jugador.setEstatus(datosJugador[6]);
jugador.setSexo(datosJugador[7]);

       //Preguntamos por matricula
int respuesta = JOptionPane.showConfirmDialog(null, "Matricula Actual:\n" + jugador.getMatricula() + "\n¿Modificar?",
"Modificar Jugador", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)//SÍ quiere modificar
jugador.setMatricula(lm5.getMatricula2());

//Preguntamos por nombre
respuesta = JOptionPane.showConfirmDialog(null, "Nombre Actual:\n" + jugador.getNombre() + "\n¿Modificar?",
"Modificar Jugador", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
jugador.setNombre(lm5.getNombreJ());

//Apellido Paterno
respuesta = JOptionPane.showConfirmDialog(null, "Apellido Paterno Actual:\n" + jugador.getAp() + "\n¿Modificar?",
"Modificar Jugador", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
jugador.setAp(lm5.getApe());

//Apellido Materno
respuesta = JOptionPane.showConfirmDialog(null, "Apellido Materno Actual:\n" + jugador.getAm() + "\n¿Modificar?",
"Modificar Jugador", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
jugador.setAm(lm5.getAma());

//Numero Camiseta
respuesta = JOptionPane.showConfirmDialog(null, "Numero Camiseta Actual:\n" + jugador.getNumeroCa() + "\n¿Modificar?",
"Modificar Jugador", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
jugador.setNumeroCa(lm5.getNumC());

//Posicion
respuesta = JOptionPane.showConfirmDialog(null, "Posicion Actual:\n" + jugador.getPosicion() + "\n¿Modificar?",
"Modificar Jugador", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
jugador.setPosicion(lm5.getPosic());

//Status
respuesta = JOptionPane.showConfirmDialog(null, "Estado Actual:\n" + jugador.getEstatus() + "\n¿Modificar?",
"Modificar Jugador", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
jugador.setEstatus(lm5.getEstatus1());

//Sexo
respuesta = JOptionPane.showConfirmDialog(null, "Sexo Actual:\n" + jugador.getSexo() + "\n¿Modificar?",
"Modificar Jugador", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
jugador.setSexo(lm5.getSex1());


        lineaModificada = jugador.toString();
}
else if (linea.endsWith("Personal"))//La linea pertenece a la clase Personal
{
   String[] datosPersonal = linea.split("\\|");
//Construimos un Jugador con los datos obtenidos
Personal p = new Personal();
p.setClave(Integer.parseInt(datosPersonal[0]));
p.setNombre(datosPersonal[1]);
p.setAp(datosPersonal[2]);
p.setAm(datosPersonal[3]);
p.setPuesto(datosPersonal[4]);
p.setEspecialidad(datosPersonal[5]);
p.setTiempoE(Integer.parseInt(datosPersonal[6]));
p.setSexo(datosPersonal[7]);

         
int respuesta = JOptionPane.showConfirmDialog(null, "Clave Actual:\n" + p.getClave() + "\n¿Modificar?",
"Modificar Personal", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)//SÍ quiere modificar
p.setClave(lm5.getClave());

//Preguntamos por nombre
respuesta = JOptionPane.showConfirmDialog(null, "Nombre Actual:\n" + p.getNombre() + "\n¿Modificar?",
"Modificar Personal", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
p.setNombre(lm5.getNombrep());

//Apellido Paterno
respuesta = JOptionPane.showConfirmDialog(null, "Apellido Paterno Actual:\n" + p.getAp() + "\n¿Modificar?",
"Modificar Personal", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
p.setAp(lm5.getAp2());

//Apellido Materno
respuesta = JOptionPane.showConfirmDialog(null, "Apellido Materno Actual:\n" + p.getAm() + "\n¿Modificar?",
"Modificar Personal", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
p.setAm(lm5.getAm2());

//Puesto
respuesta = JOptionPane.showConfirmDialog(null, "Puesto Actual:\n" + p.getPuesto() + "\n¿Modificar?",
"Modificar Personal", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
p.setPuesto(lm5.getPuesto1());

//Especialidad
respuesta = JOptionPane.showConfirmDialog(null, "Especialidad Actual:\n" + p.getEspecialidad() + "\n¿Modificar?",
"Modificar Personal", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
p.setEspecialidad(lm5.getEsp());

//Tiempo en la empresa
respuesta = JOptionPane.showConfirmDialog(null, "Estado Actual:\n" + p.getTiempoE() + "\n¿Modificar?",
"Modificar Personal", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
p.setTiempoE(lm5.getTiempoe());

//Sexo
respuesta = JOptionPane.showConfirmDialog(null, "Sexo Actual:\n" + p.getSexo() + "\n¿Modificar?",
"Modificar Personal", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
p.setSexo(lm5.getSex2());

lineaModificada = p.toString();
}
else if (linea.endsWith("Proveedor"))//La linea pertenece a la clase Proveedores
{
String[] datosProveedores = linea.split("\\|");
//Construimos un Jugador con los datos obtenidos
Proovedores pr = new Proovedores();
//pr.setClave(Integer.parseInt(datosPersonal[0]));
pr.setNombre(datosProveedores[0]);
pr.setDireccion(datosProveedores[1]);
pr.setCiudad(datosProveedores[2]);
pr.setEmail(datosProveedores[3]);
pr.setTelefono(Integer.parseInt(datosProveedores[4]));

        //Preguntamos por Nombre
int respuesta = JOptionPane.showConfirmDialog(null, "Nombre Actual:\n" + pr.getNombre() + "\n¿Modificar?",
"Modificar Personal", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)//SÍ quiere modificar
pr.setNombre(lm5.getNombrePr());

//Direccion
respuesta = JOptionPane.showConfirmDialog(null, "Direccion Actual:\n" + pr.getDireccion() + "\n¿Modificar?",
"Modificar Proveedores", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
pr.setDireccion(lm5.getDirecpr());

//Ciudad
respuesta = JOptionPane.showConfirmDialog(null, "Ciudad Actual:\n" + pr.getCiudad() + "\n¿Modificar?",
"Modificar Proveedores", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
pr.setCiudad(lm5.getCiudad1());

//Email
respuesta = JOptionPane.showConfirmDialog(null, "Email Actual:\n" + pr.getEmail() + "\n¿Modificar?",
"Modificar Proveedores", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
pr.setEmail(lm5.getEmail());

//Telefono
respuesta = JOptionPane.showConfirmDialog(null, "Telefono Actual:\n" + pr.getTelefono() + "\n¿Modificar?",
"Modificar Proveedores", JOptionPane.YES_NO_OPTION);
if (respuesta == JOptionPane.YES_OPTION)
pr.setTelefono(lm5.getTelefono());

lineaModificada = pr.toString();
}

return lineaModificada;//Finalizado el metodo, esta linea contendrá los datos de un Jugador, o un Proveedor o un Personal
}

tal vez tenga algun error el codigo de moficacion y ya lo cheque y me digue mandado ese error

10
Si dice que SI quiere modificarla, entonces no añadimos esa línea. Quizás lo más fácil sería pedir de nuevo todos los datos, crear un objeto nuevo y lo que metemos en el ArrayList es lo que nos devuelva el metodo toString() de este nuevo objeto que acabamos de crear.

De acuerdo a lo que dijiste aqui es lo que quiero que haga mi programa pero no se como implementarlo en el codigo soy novata en este lenguaje y se me es un poco complicado entender algunas cosas como lo implementaria tu en el codigo de eliminacion¿?

Disculpa por mi ignorancia  :-\

11
Tengo un pregunta para poder hacer modificación puedo utilizar osea basarme en el código de eliminación?

12
Se tiene que guardar en el mismo archivo
Código: [Seleccionar]
import java.io.*;
import javax.swing.JOptionPane;
import java.util.*;
public class CrearFile2
{
    public CrearFile2 ()
    {}
      File archivo= new File("C:\\Prueba\\EquipoV.txt");
      FileWriter f;
      BufferedWriter bw;
      Jugadores j = new Jugadores();
      LeerMostrar5 lm5 = new LeerMostrar5 ();
      Personal p = new Personal();
      Proovedores pr = new Proovedores();
     
   public void  setCrearJugadores(){
       File archivo= new File("C:\\Prueba\\EquipoV.txt");
       FileWriter f;
       BufferedWriter bw;

     try
      {
       if(archivo.exists()){
        f = new FileWriter (archivo,true);
        bw = new BufferedWriter(f);
        bw.newLine();
        j.setMatricula(lm5.getMatricula2());
        bw.write(j.getMatricula()+"|");
        j.setNombre(lm5.getNombreJ());
        bw.write(j.getNombre()+"|");
        j.setAp(lm5.getApe());
        bw.write(j.getAp()+"|");   
        j.setAm(lm5.getAma());
        bw.write(j.getAp()+"|");   
        j.setNumeroCa(lm5.getNumC());
        bw.write(j.getNumeroCa()+"|");   
        j.setPosicion(lm5.getPosic());
        bw.write(j.getPosicion()+"|");
        j.setEstatus(lm5.getEstatus1());
        bw.write(j.getEstatus()+"|");
        j.setSexo(lm5.getSex1());
        bw.write(j.getSexo()+"|");
        }
        else{
        f = new FileWriter (archivo,true);
        bw = new BufferedWriter(f);
        bw.newLine();
        j.setMatricula(lm5.getMatricula2());
        bw.write(j.getMatricula()+"|");
        j.setNombre(lm5.getNombreJ());
        bw.write(j.getNombre()+"|");
        j.setAp(lm5.getApe());
        bw.write(j.getAp()+"|");   
        j.setAm(lm5.getAma());
        bw.write(j.getAp()+"|");   
        j.setNumeroCa(lm5.getNumC());
        bw.write(j.getNumeroCa()+"|");   
        j.setPosicion(lm5.getPosic());
        bw.write(j.getPosicion()+"|");
        j.setEstatus(lm5.getEstatus1());
        bw.write(j.getEstatus()+"|");
        j.setSexo(lm5.getSex1());
        bw.write(j.getSexo()+"|");
       
        }
       //f.close();
       bw.close();
     }
      catch(Exception ex)
       {JOptionPane.showMessageDialog(null,ex);}
     
    }   
     
     public void  setCrearPersonal(){
       File archivo= new File("C:\\Prueba\\EquipoV.txt");
       FileWriter f;
       BufferedWriter bw;

     try
      {
       if(archivo.exists()){
        f = new FileWriter (archivo,true);
        bw = new BufferedWriter(f);
        bw.newLine();
               
        p.setClave(lm5.getClave());
        bw.write(p.getClave()+"|");
        p.setNombre(lm5.getNombrep());
        bw.write(lm5.getNombrep()+"|");
        p.setAp(lm5.getAp2());         
        bw.write(lm5.getAp2()+"|");
        p.setAm(lm5.getAp2());
        bw.write(p.getAm()+"|");
        p.setPuesto(lm5.getPuesto1());
        bw.write(p.getPuesto()+"|");
        p.setEspecialidad(lm5.getEsp());
        bw.write(p.getEspecialidad()+"|");
        p.setTiempoE(lm5.getTiempoe());
        bw.write(p.getTiempoE()+"|");
        p.setSexo(lm5.getSex2());
        bw.write(p.getSexo()+"|");
       } else{
        f = new FileWriter (archivo,true);
        bw = new BufferedWriter(f);
        bw.newLine();
               
        p.setClave(lm5.getClave());
        bw.write(p.getClave()+"|");
        p.setNombre(lm5.getNombrep());
        bw.write(lm5.getNombrep()+"|");
        p.setAp(lm5.getAp2());         
        bw.write(lm5.getAp2()+"|");
        p.setAm(lm5.getAp2());
        bw.write(p.getAm()+"|");
        p.setPuesto(lm5.getPuesto1());
        bw.write(p.getPuesto()+"|");
        p.setEspecialidad(lm5.getEsp());
        bw.write(p.getEspecialidad()+"|");
        p.setTiempoE(lm5.getTiempoe());
        bw.write(p.getTiempoE()+"|");
        p.setSexo(lm5.getSex2());
        bw.write(p.getSexo()+"|");
       }
         f.close();
         bw.close();
         
      }
      catch(Exception ex)
      {ex.printStackTrace();}
     }
     
     public void  setCrearProveedores() throws IOException
   {
     try
      {
      if(archivo.exists()){
        f = new FileWriter (archivo,true);
        bw = new BufferedWriter(f);
        bw.newLine();       
       
        pr.setNombre(lm5.getNombrePr());
        bw.write(pr.getNombre());
        pr.setDireccion(lm5.getDirecpr());
        bw.write(pr.getDireccion());
        pr.setCiudad(lm5.getCiudad1());         
        bw.write(pr.getCiudad());
        pr.setEmail(lm5.getEmail());
        bw.write(pr.getEmail());
        pr.setTelefono(lm5.getTelefono());
        bw.write(pr.getTelefono());
         
      }else{
     
       f = new FileWriter (archivo,true);
        bw = new BufferedWriter(f);
        bw.newLine();       
       
        pr.setNombre(lm5.getNombrePr());
        bw.write(pr.getNombre());
        pr.setDireccion(lm5.getDirecpr());
        bw.write(pr.getDireccion());
        pr.setCiudad(lm5.getCiudad1());         
        bw.write(pr.getCiudad());
        pr.setEmail(lm5.getEmail());
        bw.write(pr.getEmail());
        pr.setTelefono(lm5.getTelefono());
        bw.write(pr.getTelefono());
      } 
         f.close();
         bw.close();       
   }
      catch(Exception ex)
      {ex.printStackTrace();}
     }
     
   public void  setConsulta() throws IOException
    {
      File file = new File("C:\\Prueba\\EquipoV.txt");   
      Scanner lector;
      lector = new Scanner(System.in);
      String datoAbuscar;
      //JOptionPane.showInputDialog("Dato a buscar:");
      datoAbuscar = lector.nextLine();
      lector = new Scanner(file);
         
          while (lector.hasNextLine()) {
            String datoBuscado = lector.nextLine();
         
               if (datoBuscado.startsWith(datoAbuscar)) {
                  JOptionPane.showMessageDialog(null,"Dato Buscado:\n" +datoBuscado);
                           }
                 //while(datoBuscado!=null && ("|"));   
         }
    }
     
      public void setMostrarB() throws IOException
      {
      try {
         
         Scanner lector = new Scanner(archivo);
         String datoAbuscar =  JOptionPane.showInputDialog("Dato a buscar:");
         while (lector.hasNextLine()) {
           String datoBuscado = lector.nextLine();
           
            if (datoBuscado.startsWith(datoAbuscar)) {
                  JOptionPane.showMessageDialog(null,"Dato buscado\n" + datoBuscado);
                           }
               
                 
               }
       }catch (FileNotFoundException e) {
         JOptionPane.showMessageDialog(null, "No se ha encontrado el fichero " + archivo.getAbsolutePath());
         e.printStackTrace();//Muestra por consola la "traza" del error
      }
    }
     
      public void setEliminar() {
     
      try{
         Scanner lector = new Scanner(archivo);
         JOptionPane.showInputDialog("Dame clave a eliminar");
         String nombreE=lector.nextLine();
         if(archivo.exists()){
             
             FileReader fr = new FileReader(archivo);
             BufferedReader br = new BufferedReader(fr);
             String linea;
             int numLineas = 0;
             while((linea=br.readLine()) != null){
               
               numLineas++;
             
             }
             String datos [] = new String[numLineas];
             br.close();
             fr.close();
             br = new BufferedReader(new FileReader(archivo));
             int i =0;
                 while((linea=br.readLine()) != null){
                   datos [i]= linea;
                   i++;
                 }
                 br.close();
                 fr.close();
                 FileWriter fw = new FileWriter (archivo);
                 BufferedWriter bw = new BufferedWriter(fw);
                 boolean bandera =false;
                 boolean primeraL = true;
                 for (int j=0;j < datos.length; j++){
                      String Slinea [] = datos [j].split("|");
                      if(Slinea[0].equals(nombreE)){
                      bandera=true;
                      JOptionPane.showMessageDialog(null,"Dato eliminado");
                      }else{
                        if(primeraL ==true){// si es la primera vez que escrbimos cambiala a false
                         bw.write(datos[j]);
                         primeraL = false;
                         
                         }else{
                           bw.newLine();
                           bw.write(datos [j]);
                         }
                      }   
                 }
               if(bandera==false){
                JOptionPane.showMessageDialog(null,"No se encontro el dato");
                 }
               bw.close();
               fw.close();
                if(numLineas==1 && bandera == true){ //aqui verifica si hay un dato si no se acaba de eliminar
                 archivo.delete(); //se elimina el archivo completo
               }
         }else{
         
          JOptionPane.showMessageDialog(null,"No hay datos");
         }
      }catch (Exception e){
        //JOptionPane.showMessageDialog(e);
      }
    }
 }   
   
 

   

13
Lo que tienes que tengo hacer es un equipo de voleibol que tengas jugadores, personal y proveedores, lo que tengo que hacer es registrar, Eliminar, consultar, modificar y que me muestre todo lo que tengo en el archivo lo que utilizó en las clases de get y set es polimorfismo y herencia de l clase que heredó es de personas para las clases de jugadores, personas y para la clases de proveedores sólo utilizó lo que es el nombre

14
el meu lo tengo asi por que el maestro lo requiere de esa forma esa son todas mis clases con las que estoy trabajando, siento que algo hace que no me perimita eliminar o mi codigo con que esta muy revuelto Gracias por la ayuda

Código: [Seleccionar]
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class MenuBueno
{
   public MenuBueno()
   {}
   
   public static void main(String args[]) throws IOException
   {
      MenuV2 m = new MenuV2();
      m.setMenuV2();
   }
}

15
Código: [Seleccionar]
import javax.swing.JOptionPane;
import java.io.*;
public class MenuV2
{
   MenuV2 m;
   CrearFile cf;
   BufferedReader br;
   
   public MenuV2()
   {}
   
   /*public  void  setOpcion()
   {
      JOptionPane.showInputDialog(null,"1.Agregar\n"+"2.Salir\n");
      return;
   }*/
   
   public void setMenuV2() throws IOException
    {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      CrearFile2 cf2 = new CrearFile2();
      Jugadores j = new Jugadores();
      MenuV2 m = new MenuV2();
      int opcion = 0;
      do
         {
         opcion=Integer.parseInt(JOptionPane.showInputDialog(null,"1.Registrar\n"+"2.Eliminar registro\n"+"3.Consultar\n"+"4.Salir"));
         switch (opcion)
            {
            case 1:
            int opc=0;
            do
              {
              opc=Integer.parseInt(JOptionPane.showInputDialog(null,"1.Agregar jugadores\n"+"2.Agregar Personal\n"+"3.Agregar Proveedores\n"+"4.Salir"));
              switch(opc){
              case 1:
              cf2.setCrearJugadores(); break;
              case 2:
              //cf2.setCrearPersonal(); break;
              case 3:
               //cf2.setCrearProveedores(); break;
              case 4:
              break;
              }
             }while(opc!=4);
               break;
            case 2:
            cf2.setEliminar(); break; 
            case 3:
            cf2.setMostrarB();break;         
            case 4:
            JOptionPane.showMessageDialog(null,"Salio del sistema"); break;
           
            default:
             JOptionPane.showMessageDialog(null,"Opcion inavalida");
             
             }
          }while(opcion!=4);
   }
}

16
Código: [Seleccionar]
import java.io.*;
import javax.swing.*;
import java.util.ArrayList;
public class LeerMostrar5
{
   
   
   Jugadores j = new Jugadores();
   Personal p = new Personal();
   Proovedores pr = new Proovedores();
 
  public LeerMostrar5 ()
   {}
   
   public int getMatricula2() throws IOException
   {
      boolean bandera = false;
      do
       {
         try
           {
            j.setMatricula(Integer.parseInt(JOptionPane.showInputDialog("Matricula del jugador:")));
              bandera=true;
               }
          catch(NumberFormatException e)
          {JOptionPane.showMessageDialog(null,"El dato ingresado no es correcto");}
        }while(bandera!=true);
        JOptionPane.showMessageDialog(null,"Matricula\n"+j.getMatricula());
        return j.getMatricula();
    }
         
     public String getNombreJ() throws IOException
     {
     boolean bandera = false;
      do
         {
          try
             {
               j.setNombre(JOptionPane.showInputDialog("Nombre:\r\n"));
               bandera = true;
               }
          catch(NumberFormatException nft)
          {JOptionPane.showMessageDialog(null,"El dato ingresado no es correcto");}
         }while(bandera!=true);
         JOptionPane.showMessageDialog(null,"Nombre\n"+j.getNombre());
       return j.getNombre();
     }
     
     public String getApe() throws IOException
      {
       boolean bandera = false;
     
       do
        {
          try
            {
               j.setAp(JOptionPane.showInputDialog("Apellido paterno:"));
               bandera = true;
              }
           catch(NumberFormatException nft)
          {JOptionPane.showMessageDialog(null,"El dato ingresado no es correcto");}
         }while (bandera!=true);
         JOptionPane.showMessageDialog(null,"Apellido Paterno\n"+j.getAp());
        return j.getAp();
     }
         
      public String getAma() throws IOException
       {
       boolean bandera = false;   
        do
         {
           try
           {
               j.setAm(JOptionPane.showInputDialog("Apellido materno:"));
               bandera=true;
             }
             catch(NumberFormatException nft)
          {JOptionPane.showMessageDialog(null,"El dato ingresado no es correcto");}
         }while(bandera!=true);
         JOptionPane.showMessageDialog(null,"Apellido Materno\n"+j.getAm());
         return j.getAm();
      }
     
      public int getNumC() throws IOException
       {
       boolean bandera=false;           
       do
        {
          try
          {
               j.setNumeroCa(Integer.parseInt(JOptionPane.showInputDialog("Numero de camisa:\r\n"+"")));
               bandera=true;
               }
           catch(Exception e)
          {JOptionPane.showMessageDialog(null,"El dato ingresado no es correcto");}
         }while(bandera!=true);
         JOptionPane.showMessageDialog(null,"Numero de Camisa\n"+j.getNumeroCa());
         return j.getNumeroCa();
       }
     
      public String getPosic() throws IOException
      {
      boolean bandera = false;
        do
         {
         try
            {
              j.setPosicion(JOptionPane.showInputDialog("Posicion:\r\n"));
              bandera=true;
             }
          catch(NumberFormatException nft)
          {JOptionPane.showMessageDialog(null,"El dato ingresado no es correcto");}
         }while(bandera!=true);
         JOptionPane.showMessageDialog(null,"Numero de Camisa\n"+j.getPosicion());
        return j.getPosicion();
       }
       
   public String getEstatus1() throws IOException
    {
     boolean  bandera = false; 
       do
         {
          try
           {
             j.setEstatus(JOptionPane.showInputDialog("Estatus:"));
              bandera=true;
            }
         catch(NumberFormatException nft)
          {JOptionPane.showMessageDialog(null,"Error ingreso un dato no valido");}
      }while(bandera!=true);
      JOptionPane.showMessageDialog(null,"Numero de Camisa\n"+j.getEstatus());
     return j.getEstatus();
   }
   
   public Object getSex1 () throws IOException
   {
   
      j.setSexo(JOptionPane.showInputDialog(null,"Seleccione sexo","Sexo",
            JOptionPane.QUESTION_MESSAGE,null, new Object[]
                        { "Masculino", "Femenino"},"Masculino"));
                  JOptionPane.showMessageDialog(null,"Numero de Camisa\n"+j.getSexo());
                        return j.getSexo();
   }
   
   
   /*Ingresar datos de personal*/
   
   public int getClave() throws IOException
   {
      boolean bandera = false;
      do
       {
         try
           {
              p.setClave(Integer.parseInt(JOptionPane.showInputDialog("Clave:\t")));
              bandera=true;
               }
          catch(NumberFormatException e)
          {JOptionPane.showMessageDialog(null,"El dato ingresado no es correcto");}
        }while(bandera!=true);
        return p.getClave();
      }
         
     public String getNombrep() throws IOException
     {
     boolean bandera = false;
      do
         {
          try
             {
               p.setNombre(JOptionPane.showInputDialog("Nombre:\t"));
               bandera = true;
               }
          catch(NumberFormatException nft)
          {JOptionPane.showMessageDialog(null,"El dato ingresado no es correcto");}
         }while(bandera!=true);
       return p.getNombre();
     }
     
     public String getAp2() throws IOException
      {
       boolean bandera = false;
     
       do
        {
          try
            {
               p.setAp(JOptionPane.showInputDialog("Apellido paterno:"));
               bandera = true;
              }
           catch(NumberFormatException nft)
          {JOptionPane.showMessageDialog(null,"El dato ingresado no es correcto");}
         }while (bandera!=true);
        return p.getAp();
     }
         
      public String getAm2() throws IOException
       {
       boolean bandera = false;   
        do
         {
           try
           {
               p.setAm(JOptionPane.showInputDialog("Apellido materno:"));
               bandera=true;
             }
             catch(NumberFormatException nft)
          {JOptionPane.showMessageDialog(null,"El dato ingresado no es correcto");}
         }while(bandera!=true);
         return p.getAm();
      }
     
      public String getPuesto1() throws IOException
       {
       boolean bandera=false;           
       do
        {
          try
          {
               p.setPuesto(JOptionPane.showInputDialog("Puesto:\t"));
               bandera=true;
               }
           catch(NumberFormatException nft)
          {JOptionPane.showMessageDialog(null,"El dato ingresado no es correcto");}
         }while(bandera!=true);
       return p.getPuesto();
       }
     
      public String getEsp() throws IOException
      {
      boolean bandera = false;
        do
         {
         try
            {
               p.setEspecialidad(JOptionPane.showInputDialog("Especialidad:\t"));
                bandera=true;
             }
          catch(NumberFormatException nft)
          {JOptionPane.showMessageDialog(null,"El dato ingresado no es correcto");}
         }while(bandera!=true);
        return  p.getEspecialidad();
       }
       
   public int getTiempoe() throws IOException
    {
     boolean  bandera = false; 
       do
         {
          try
           {
             p.setTiempoE(Integer.parseInt(JOptionPane.showInputDialog("Tiempo en la empresa:\t")));
             bandera=true;
            }
         catch(NumberFormatException nft)
          {JOptionPane.showMessageDialog(null,"Error ingreso un dato no valido");}
      }while(bandera!=true);
     return p.getTiempoE();
   }
   
   public Object getSex2 () throws IOException
   {
   
      p.setSexo(JOptionPane.showInputDialog(null,"Seleccione sexo","Sexo",
            JOptionPane.QUESTION_MESSAGE,null, new Object[]
                        { "Masculino", "Femenino"},"Masculino"));
                        return p.getSexo();
   }
   
   /* Ingresar Proveedores*/
   public String getNombrePr() throws IOException
   {
      boolean bandera = false;
      do
       {
         try
           {
              pr.setNombre(JOptionPane.showInputDialog("Proveedor:\t"));
              bandera=true;
               }
          catch(NumberFormatException e)
          {JOptionPane.showMessageDialog(null,"El dato ingresado no es correcto");}
        }while(bandera!=true);
        return pr.getNombre();
      }
         
     public String getDirecpr() throws IOException
     {
     boolean bandera = false;
      do
         {
          try
             {
               pr.setDireccion(JOptionPane.showInputDialog("Direccion:\t"));
               bandera = true;
               }
          catch(NumberFormatException nft)
          {JOptionPane.showMessageDialog(null,"El dato ingresado no es correcto");}
         }while(bandera!=true);
       return pr.getDireccion();
     }
     
     public String getCiudad1() throws IOException
      {
       boolean bandera = false;
     
       do
        {
          try
            {
              pr.setCiudad(JOptionPane.showInputDialog("Ciudad:\t"));
               bandera = true;
              }
           catch(NumberFormatException nft)
          {JOptionPane.showMessageDialog(null,"El dato ingresado no es correcto\t");}
         }while (bandera!=true);
        return pr.getCiudad();
     }
         
      public String getEmail() throws IOException
       {
       boolean bandera = false;   
        do
         {
           try
           {
               pr.setEmail(JOptionPane.showInputDialog("Email:\t"));
               bandera=true;
             }
             catch(NumberFormatException nft)
          {JOptionPane.showMessageDialog(null,"El dato ingresado no es correcto");}
         }while(bandera!=true);
         return pr.getEmail();
      }                 
   public int getTelefono() throws IOException
    {
     boolean  bandera = false; 
       do
         {
          try
           {
             pr.setTelefono(Integer.parseInt(JOptionPane.showInputDialog("telefono:\t")));
             bandera=true;
            }
         catch(NumberFormatException nft)
          {JOptionPane.showMessageDialog(null,"Error ingreso un dato no valido");}
      }while(bandera!=true);
     return pr.getTelefono();
   }

  }

17
Código: [Seleccionar]
public class Proovedores extends Personas
{
   private String direccion;
   private String ciudad;
   private String email;
   private int telefono;
   
   public Proovedores()
   {
      direccion = null;
      ciudad = null;
      email = null;
      telefono = 0;
     
   }
   
   public void setDireccion(String direccion)
    {
      this.direccion = direccion;
    }
   public String getDireccion ()
    {
      return direccion;
    }
    public void setCiudad(String ciudad)
    {
      this.ciudad = ciudad;
    }
   public String getCiudad ()
    {
      return ciudad;
    }
    public void setEmail(String email)
    {
      this.email = email;
    }
   public String getEmail ()
    {
      return email;
    }
    public void setTelefono(int telefono)
    {
      this.telefono = telefono;
    }
   public int getTelefono ()
    {
      return telefono;
    }
   
}

18
Código: [Seleccionar]
public class Personal extends Personas
{
   private int clave;
   private String puesto;
   private String especialidad;
   private int tiempoe;
   
   public Personal()
   {
     clave = 0;
     puesto = null;
     especialidad = null;
     tiempoe = 0;
   }
   
   public void setClave(int clave)
    {
      this.clave = clave;
    }
   public int getClave ()
    {
      return clave;
    }

   public void setPuesto(String puesto)
    {
      this.puesto = puesto;
    }
   public String getPuesto ()
   {
      return puesto;
   }
   
    public void setEspecialidad(String especialidad)
   {
      this.especialidad = especialidad;
   }
   public String getEspecialidad()
   {
      return especialidad;
   }
   
   public void setTiempoE(int tiempoe)
    {
      this.tiempoe = tiempoe;
    }
   public int getTiempoE()
    {
      return tiempoe;
    }


}

19
Código: [Seleccionar]
public class Jugadores extends Personas
{
   private int matricula;
   private String posicion ;
   private int numeroca;
   private String estatus;
   
   public Jugadores()
   {
       matricula = 0;
       posicion = null ;
       numeroca = 0;
       estatus = null;
   }
   
   public void setMatricula(int matricula)
   {
      this.matricula = matricula;
   }
   public int getMatricula()
   {
      return matricula;
   }
   
   public void setPosicion(String posicion)
   {
      this.posicion = posicion;
   }
   public String getPosicion()
   {
      return posicion;
   }
   
   public void setNumeroCa(int numeroca)
   {
      this.numeroca = numeroca;
   }
   public int getNumeroCa()
   {
      return numeroca;
   }
   
   public void setEstatus(String estatus)
   {
      this.estatus = estatus;
   }
   public String getEstatus()
   {
      return estatus;
   }



   
}

20
tengo la clase personas donde va a heredrarle algunos datos a mis demas clases

Código: [Seleccionar]
public class Personas
{
   private String nombre;
   private String ap;
   private String am;
   private Object sexo;
   
 
   public Personas()
   {
      nombre = null;
      ap = null;
      am= null;
      sexo = 0;
     
   }
     
  public void setNombre (String  nombre)
   {
      this.nombre=nombre;
   }
   public String getNombre()
   {
      return nombre;
   }
   
   public void setAp (String ap)
   {
      this.ap=ap;
   }
   public String getAp()
   {
      return ap;
   }
   public void setAm (String Am)
   {
      this.am=am;
   }
   public String getAm()
   {
      return am;
   }
   public void setSexo (Object sexo)
   {
      this.sexo=sexo;
   }
   public Object getSexo()
   {
      return sexo;
   }

}

Páginas: [1] 2

Sobre la educación, sólo puedo decir que es el tema más importante en el que nosotros, como pueblo, debemos involucrarnos.

Abraham Lincoln (1808-1865) Presidente estadounidense.

aprenderaprogramar.com: Desde 2006 comprometidos con la didáctica y divulgación de la programación

Preguntas y respuestas

¿Cómo establecer o cambiar la imagen asociada (avatar) de usuario?
  1. Inicia sesión con tu nombre de usuario y contraseña.
  2. Pulsa en perfil --> perfil del foro
  3. Elige la imagen personalizada que quieras usar. Puedes escogerla de una galería de imágenes o subirla desde tu ordenador.
  4. En la parte final de la página pulsa el botón "cambiar perfil".