Guest User

Untitled

a guest
Nov 23rd, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. /*
  2. * To change this template, choose Tools | Templates
  3. * and open the template in the editor.
  4. */
  5. package estudiante;
  6.  
  7. /**
  8. *
  9. * @author Bryan
  10. */
  11. public class Estudiante {
  12.  
  13.  
  14. private String nombre;
  15. private int edad;
  16. private double nota;
  17. private long id;
  18. private int anho;
  19. private char sexo;
  20.  
  21. Estudiante(String nombre, int edad, double nota, long id, int año, char sexo){
  22. this.nombre = nombre;
  23. this.edad = edad;
  24. this.nota = nota;
  25. this.id = id;
  26. this.anho = anho;
  27. this.sexo = sexo;
  28.  
  29. }
  30. Estudiante (){
  31. this.nombre = "sin nombre";
  32. this.edad = 0;
  33. this.nota = 0.0;
  34. this.id = 0;
  35. this.anho = 0;
  36. this.sexo = 'm';
  37.  
  38. }
  39.  
  40. public String getNombre(){
  41. return this.nombre;
  42. }
  43. public void setNombre(String nombre){
  44. this.nombre = nombre;
  45. }
  46.  
  47. public int getEdad(){
  48. return this.edad;
  49. }
  50. public void setEdad(int edad){
  51. this.edad = edad;
  52. }
  53.  
  54. public double getNota(){
  55. return this.nota;
  56. }
  57. public void setNota(double nota){
  58. this.nota = nota;
  59. }
  60.  
  61. public long getId(){
  62. return this.id;
  63. }
  64. public long setId(long id){
  65. return this.id = id;
  66. }
  67.  
  68. public int getAnho(){
  69. return this.anho;
  70. }
  71. public int setAnho(int anho){
  72. return this.anho = anho;
  73. }
  74.  
  75. public char getsexo(){
  76. return this.sexo;
  77. }
  78. public char setSexo(char sexo){
  79. return this.sexo = sexo;
  80. }
  81.  
  82.  
  83. public void imprimir(){
  84. System.out.println(" Nombre: "+ nombre);
  85. System.out.println(" Edad: "+ edad);
  86. System.out.println(" Nota: "+ nota);
  87. System.out.println(" Identificación: "+ id);
  88. System.out.println(" Año de ingreso: "+ anho);
  89. System.out.println(" Sexo: "+ sexo);
  90.  
  91. }
  92. public static double calcularPromedio(Estudiante [] grupo){
  93. double sumatoria = 0.0;
  94.  
  95. for(int i=0; i<grupo.length; i++){
  96. sumatoria += grupo [i].getNota();
  97. }
  98. return sumatoria/grupo.length;
  99. }
  100.  
  101. }
Add Comment
Please, Sign In to add comment