Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package estudiante;
- /**
- *
- * @author Bryan
- */
- public class Estudiante {
- private String nombre;
- private int edad;
- private double nota;
- private long id;
- private int anho;
- private char sexo;
- Estudiante(String nombre, int edad, double nota, long id, int año, char sexo){
- this.nombre = nombre;
- this.edad = edad;
- this.nota = nota;
- this.id = id;
- this.anho = anho;
- this.sexo = sexo;
- }
- Estudiante (){
- this.nombre = "sin nombre";
- this.edad = 0;
- this.nota = 0.0;
- this.id = 0;
- this.anho = 0;
- this.sexo = 'm';
- }
- public String getNombre(){
- return this.nombre;
- }
- public void setNombre(String nombre){
- this.nombre = nombre;
- }
- public int getEdad(){
- return this.edad;
- }
- public void setEdad(int edad){
- this.edad = edad;
- }
- public double getNota(){
- return this.nota;
- }
- public void setNota(double nota){
- this.nota = nota;
- }
- public long getId(){
- return this.id;
- }
- public long setId(long id){
- return this.id = id;
- }
- public int getAnho(){
- return this.anho;
- }
- public int setAnho(int anho){
- return this.anho = anho;
- }
- public char getsexo(){
- return this.sexo;
- }
- public char setSexo(char sexo){
- return this.sexo = sexo;
- }
- public void imprimir(){
- System.out.println(" Nombre: "+ nombre);
- System.out.println(" Edad: "+ edad);
- System.out.println(" Nota: "+ nota);
- System.out.println(" Identificación: "+ id);
- System.out.println(" Año de ingreso: "+ anho);
- System.out.println(" Sexo: "+ sexo);
- }
- public static double calcularPromedio(Estudiante [] grupo){
- double sumatoria = 0.0;
- for(int i=0; i<grupo.length; i++){
- sumatoria += grupo [i].getNota();
- }
- return sumatoria/grupo.length;
- }
- }
Add Comment
Please, Sign In to add comment