Advertisement
Guest User

tipos_usuario_biblioteca

a guest
Feb 6th, 2017
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.45 KB | None | 0 0
  1. //////////////////////////////// Estudiante ///////////////////////////////////////////////////
  2.  
  3. class Estudiante extends Usuario {
  4.    
  5.     //Atributos
  6.     protected String programa;
  7.     protected 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.     protected  String Institucion;
  25.     protected 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.     protected 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 (para pruebas porque la clase Usuario definitiva es de Mery) //////////////////
  52.  
  53. public abstract class Usuario {
  54.     //Atributos
  55.         protected String nombre;
  56.         protected String apellidos;
  57.         protected boolean sancion;
  58.         protected String correo;
  59.        
  60.     //Constructor
  61.         public Usuario(String nombre, String apellidos, boolean sancion, String correo){
  62.             this.nombre = nombre;
  63.             this.apellidos = apellidos;
  64.             this.sancion = sancion;
  65.             this.correo = correo;
  66.         }  
  67.        
  68.         public static void main (String [] args){
  69.            
  70.         //Usuarios por defecto:
  71.            
  72.         Estudiante E1 = new Estudiante("Pedro","Ramírez",false,"pedro01@eia.edu.co","Ingeniería Administrativa","001");
  73.         Estudiante E2 = new Estudiante("Andres","Ochoa",false,"andres8@eia.edu.co","Ingeniería Mecánica","002");
  74.  
  75.         Externo EX1 = new Externo("Andrea","Muñoz",false,"munozandrea@udea.edu.co","Universidad de Antioquia","003");
  76.         Externo EX2 = new Externo("Daniela","Rua",false,"rua.daniela@eafit.edu.co","Universidad EAFIT","004");
  77.        
  78.         Profesor P1 = new Profesor("Felipe","Herrera",true,"felipeh@eia.edu.co","005");
  79.         Profesor P2 = new Profesor("Sandra","Marin",true,"sandramarin@eia.edu.co","005");
  80.        
  81.         }
  82.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement