Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.JOptionPane;
- public class Empleado {
- String nombre;
- int matricula;
- public Empleado(String nom, int mat){
- nombre = nom;
- matricula = mat;
- }
- public void imprime()
- {
- JOptionPane.showMessageDialog(null, "\nNombre: "+nombre+ "\nMatricula: " +matricula);
- }
- }
- ...........
- import javax.swing.JOptionPane;
- public class Administrativo extends Empleado
- {
- int sueldo, telefono;
- public Administrativo(String nombre,int matricula,int su,int tel)
- {
- super(nombre,matricula);
- sueldo = su;
- telefono= tel;
- }
- public void imprimeA()
- {
- JOptionPane.showMessageDialog(null, "\nNombre: "+nombre+ "\nMatricula: " +matricula+ "\nSueldo: "+sueldo+ "\nTelefono: "+telefono);
- }
- }
- ........
- import javax.swing.JOptionPane;
- public class Profesor extends Empleado
- {
- String especialidad;
- public Profesor(String nombre,int matricula, String es)
- {
- super(nombre,matricula);
- especialidad = es;
- }
- public void imprimeP()
- {
- JOptionPane.showMessageDialog(null, "\nNombre: "+nombre+ "\nMatricula: " +matricula+ "\nSueldo: "+especialidad);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment