Advertisement
ana_09

Student

Mar 20th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. package model;
  2.  
  3. public class Student {
  4. String indeks;
  5. String ime;
  6. String prezime;
  7. String grad;
  8. int [] ocene;
  9.  
  10. // konstruktor bez paramatara
  11. public Student(){
  12. this.ime=" ";
  13. this.prezime=" ";
  14. this.indeks=" ";
  15. this.grad=" ";
  16. this.ocene=new int[4];
  17. }
  18. // konstruktor sa paramterima
  19. public Student(String indeks, String ime, String prezime, String grad, int[] ocene) {
  20. super();
  21. this.indeks = indeks;
  22. this.ime = ime;
  23. this.prezime = prezime;
  24. this.grad = grad;
  25. this.ocene = ocene;
  26. }
  27.  
  28. // konstruktor kopije
  29. public Student(Student original) {
  30. this.ime=original.ime;
  31. this.prezime=original.prezime;
  32. this.grad=original.grad;
  33. this.indeks=original.indeks;
  34. this.ocene=original.ocene;
  35.  
  36. }
  37.  
  38. double izracunajProsek() {
  39. int zbirOcena=0;
  40. for(int i=0;i<ocene.length;i++) {
  41. zbirOcena+=ocene[i];
  42.  
  43. }
  44. return zbirOcena/ocene.length;
  45. }
  46.  
  47.  
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement