Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Write a description of class Alumno here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class Alumnos
- {
- // declaración de variables
- private String rut; //
- private String nombre;
- private int edad;
- private char sexo; // 'F' o 'M'
- private double PromedioNotas;
- private boolean vigente; // true o false
- /**
- * Este es el constructor sin parametros
- */
- public Alumnos()
- {
- this.rut = "13193029-1";
- this.nombre = "Juanito Pérez";
- this.edad = 28;
- this.sexo= 'M';
- this.PromedioNotas = 4.5;
- this.vigente = true;
- }
- /**
- * constructor con parámetros
- * @param rut
- * @param nombre
- * @param edad
- * @param sexo
- * @param promedioNotas
- * @param vigente
- */
- public Alumnos(String rut,String nombre,int edad,char sexo,double promedioNotas, boolean vigente)
- {
- this.rut = rut;
- this.nombre = nombre;
- this.edad = edad;
- this.sexo = sexo;
- this.PromedioNotas = promedioNotas;
- this.vigente = vigente;
- }
- //mutadores
- public void setRut(String rut)
- {
- this.rut = rut;
- }
- public void setNombre(String nombre)
- {
- this.nombre = nombre;
- }
- public void setEdad(int edad)
- {
- this.edad = edad;
- }
- public void setSexo(char sexo)
- {
- this.sexo = sexo;
- }
- public void setPromedioNotas(double promedioNotas)
- {
- this.PromedioNotas = promedioNotas;
- }
- public void setVigente(boolean vigente)
- {
- this.vigente = vigente;
- }
- //accesadores
- public String getRut()
- {
- return this.rut;
- }
- public String getNombre()
- {
- return this.nombre;
- }
- public int getEdad()
- {
- return this.edad;
- }
- public char getSexo()
- {
- return this.sexo;
- }
- public double getPromedioNotas()
- {
- return this.PromedioNotas;
- }
- public boolean getVigente()
- {
- return this.vigente;
- }
- public void impresionAlumnos()
- {
- System.out.println("Datos Alumnos");
- System.out.println();
- System.out.println("Rut: " + this.getRut());
- System.out.println("Nombre: " + this.getNombre());
- System.out.println("Edad: " + this.getEdad());
- System.out.println("Sexo (M o F): " + this.getSexo());
- System.out.println("Promedio Notas: " + this.getPromedioNotas());
- System.out.println("¿Esta Vigente? (True o False): " + this.getVigente());
- System.out.println(this.aumentarPromedio(4));
- }
- //Este es el Método para aumentar el promedio
- public double aumentarPromedio(double valor)
- {
- return valor + this.getPromedioNotas();
- }
- }
Add Comment
Please, Sign In to add comment