Don't like ads? PRO users don't see any ads ;-)
Guest

examen1 Empleado

By: Xtrminator on Mar 1st, 2012  |  syntax: None  |  size: 1.30 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import javax.swing.JOptionPane;
  2. public class Empleado {
  3.      String nombre;
  4.      int matricula;
  5.      public Empleado(String nom, int mat){
  6.      
  7.         nombre = nom;
  8.         matricula = mat;
  9.        
  10.      }
  11.       public void imprime()
  12.      
  13.       {
  14.         JOptionPane.showMessageDialog(null, "\nNombre: "+nombre+ "\nMatricula: " +matricula);
  15.  
  16.       }
  17. }
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24. ...........
  25.  
  26.  
  27. import javax.swing.JOptionPane;
  28. public class Administrativo extends Empleado
  29. {
  30.     int sueldo, telefono;
  31.    
  32.    
  33.     public Administrativo(String nombre,int matricula,int su,int tel)
  34.    
  35.     {
  36.     super(nombre,matricula);
  37.     sueldo = su;
  38.     telefono= tel;
  39.     }
  40.      public void imprimeA()
  41.      {
  42.             JOptionPane.showMessageDialog(null, "\nNombre: "+nombre+  "\nMatricula: " +matricula+ "\nSueldo: "+sueldo+ "\nTelefono: "+telefono);
  43.  
  44.      }
  45. }
  46.  
  47.  
  48.  
  49.  
  50. ........
  51.  
  52.  
  53.  
  54.  
  55. import javax.swing.JOptionPane;
  56. public class Profesor extends Empleado
  57. {
  58.     String especialidad;
  59.    
  60.    
  61.     public Profesor(String nombre,int matricula, String es)
  62.    
  63.     {
  64.     super(nombre,matricula);
  65.     especialidad = es;
  66.     }
  67.      public void imprimeP()
  68.      {
  69.             JOptionPane.showMessageDialog(null, "\nNombre: "+nombre+  "\nMatricula: " +matricula+ "\nSueldo: "+especialidad);
  70.  
  71.      }
  72. }