GatoBooster

Alumno

Mar 17th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.85 KB | None | 0 0
  1.  
  2. /**
  3.  * Write a description of class Alumno here.
  4.  *
  5.  * @author (your name)
  6.  * @version (a version number or a date)
  7.  */
  8. public class Alumnos
  9. {
  10.    // declaración de variables
  11.    private String rut; //
  12.    private String nombre;
  13.    private int edad;
  14.    private char sexo; // 'F' o 'M'
  15.    private double PromedioNotas;
  16.    private boolean vigente; // true o false
  17.    
  18.    
  19.    /**
  20.     * Este es el constructor sin parametros
  21.     */
  22.    public Alumnos()
  23.    {
  24.     this.rut = "13193029-1";
  25.     this.nombre = "Juanito Pérez";
  26.     this.edad = 28;
  27.     this.sexo= 'M';
  28.     this.PromedioNotas = 4.5;
  29.     this.vigente = true;
  30.    
  31.     }
  32.    
  33.     /**
  34.      * constructor con parámetros
  35.      * @param rut
  36.      * @param nombre
  37.      * @param edad
  38.      * @param sexo
  39.      * @param promedioNotas
  40.      * @param vigente
  41.      */
  42.    
  43.     public Alumnos(String rut,String nombre,int edad,char sexo,double promedioNotas, boolean vigente)
  44.     {
  45.    
  46.     this.rut = rut;
  47.     this.nombre = nombre;
  48.     this.edad = edad;
  49.     this.sexo = sexo;
  50.     this.PromedioNotas = promedioNotas;
  51.     this.vigente = vigente;
  52.    
  53.     }
  54.    
  55.     //mutadores
  56.     public void setRut(String rut)
  57.     {
  58.     this.rut = rut;
  59.     }
  60.    
  61.     public void setNombre(String nombre)
  62.     {  
  63.     this.nombre = nombre;
  64.     }
  65.    
  66.     public void setEdad(int edad)
  67.     {
  68.     this.edad = edad;
  69.     }
  70.    
  71.     public void setSexo(char sexo)
  72.     {
  73.     this.sexo = sexo;
  74.     }
  75.    
  76.     public void setPromedioNotas(double promedioNotas)
  77.     {
  78.         this.PromedioNotas = promedioNotas;
  79.     }
  80.    
  81.     public void setVigente(boolean vigente)
  82.     {
  83.     this.vigente = vigente;
  84.     }
  85.    
  86.     //accesadores
  87.    
  88.     public String getRut()
  89.     {
  90.     return this.rut;
  91.     }
  92.    
  93.     public String getNombre()
  94.     {
  95.     return this.nombre;
  96.     }
  97.    
  98.     public int getEdad()
  99.     {
  100.     return this.edad;
  101.     }
  102.    
  103.     public char getSexo()
  104.     {
  105.     return this.sexo;
  106.     }
  107.    
  108.     public double getPromedioNotas()
  109.     {
  110.     return this.PromedioNotas;
  111.     }
  112.    
  113.     public boolean getVigente()
  114.     {
  115.     return this.vigente;
  116.     }
  117.    
  118.     public void impresionAlumnos()
  119.     {
  120.     System.out.println("Datos Alumnos");
  121.     System.out.println();
  122.     System.out.println("Rut: " + this.getRut());
  123.     System.out.println("Nombre: " + this.getNombre());
  124.     System.out.println("Edad: " + this.getEdad());
  125.     System.out.println("Sexo (M o F): " + this.getSexo());
  126.     System.out.println("Promedio Notas: " + this.getPromedioNotas());
  127.     System.out.println("¿Esta Vigente? (True o False): " + this.getVigente());
  128.     System.out.println(this.aumentarPromedio(4));
  129.     }
  130.    
  131.    
  132.     //Este es el Método para aumentar el promedio
  133.     public double aumentarPromedio(double valor)
  134.     {
  135.     return valor + this.getPromedioNotas();
  136.     }
  137.        
  138.    
  139. }
Add Comment
Please, Sign In to add comment