Xtrminator

examen1 Empleado

Mar 1st, 2012
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment