Advertisement
Guest User

Untitled

a guest
Feb 6th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.48 KB | None | 0 0
  1. //////////////////////////////// Estudiante ///////////////////////////////////////////////////
  2.  
  3. class Estudiante extends Usuario {
  4.    
  5.     //Atributos
  6.     public String programa;
  7.     public String carnet;
  8.    
  9.     //Constructor
  10.     public Estudiante(String nombre, String apellidos, boolean sancion, String correo, String programa, String carnet) {
  11.        
  12.         super(nombre, apellidos, sancion, correo);
  13.         this.programa = programa;
  14.         this.carnet = carnet;
  15.     }
  16. }
  17.  
  18.  
  19. /////////////////////////////////////// Externo //////////////////////////////////////////////
  20.  
  21. class Externo extends Usuario{
  22.    
  23.     //Atributos
  24.     public String Institucion;
  25.     public String carnetExt;
  26.  
  27.     public Externo(String nombre, String apellidos, boolean sancion, String correo, String Institucion, String carnetExt) {
  28.        
  29.         super(nombre, apellidos, sancion, correo);
  30.         this.Institucion = Institucion;
  31.         this.carnetExt = carnetExt;
  32.     }
  33. }
  34.  
  35. ////////////////////////////////////// Profesor ////////////////////////////////////////////////
  36.  
  37. class Profesor extends Usuario {
  38.    
  39.     //Atributos
  40.    
  41.     public String IdProfesor;
  42.    
  43.     public Profesor(String nombre, String apellidos, boolean sancion, String correo, String IdProfesor) {
  44.        
  45.         super(nombre, apellidos, sancion, correo);
  46.         this.IdProfesor = IdProfesor;
  47.     }
  48. }
  49.  
  50.  
  51. ///////////////////////////// USUARIO (PRUEBA) ///////////////////////////////////////////////////
  52.  
  53.  
  54. public abstract class Usuario {
  55.     //Atributos
  56.         protected String nombre;
  57.         protected String apellidos;
  58.         protected boolean sancion;
  59.         protected String correo;
  60.        
  61.     //Constructor
  62.         public Usuario(String nombre, String apellidos, boolean sancion, String correo){
  63.             this.nombre = nombre;
  64.             this.apellidos = apellidos;
  65.             this.sancion = sancion;
  66.             this.correo = correo;
  67.         }  
  68.        
  69.         public static void main (String [] args){
  70.            
  71.         //Crear Usuarios por defecto:
  72.            
  73.         Estudiante E1 = new Estudiante("Pedro","Ramírez",false,"pedro01@eia.edu.co","Ingeniería Administrativa","001");
  74.         Estudiante E2 = new Estudiante("Andres","Ochoa",false,"andres8@eia.edu.co","Ingeniería Mecánica","002");
  75.  
  76.         Externo EX1 = new Externo("Andrea","Muñoz",false,"munozandrea@udea.edu.co","Universidad de Antioquia","003");
  77.         Externo EX2 = new Externo("Daniela","Rua",false,"rua.daniela@eafit.edu.co","Universidad EAFIT","004");
  78.        
  79.         Profesor P1 = new Profesor("Felipe","Herrera",true,"felipeh@eia.edu.co","005");
  80.         Profesor P2 = new Profesor("Sandra","Marin",true,"sandramarin@eia.edu.co","005");
  81.        
  82.         System.out.println(P2.correo);
  83.         }
  84.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement