Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package model;
- public class Student {
- String indeks;
- String ime;
- String prezime;
- String grad;
- int [] ocene;
- // konstruktor bez paramatara
- public Student(){
- this.ime=" ";
- this.prezime=" ";
- this.indeks=" ";
- this.grad=" ";
- this.ocene=new int[4];
- }
- // konstruktor sa paramterima
- public Student(String indeks, String ime, String prezime, String grad, int[] ocene) {
- super();
- this.indeks = indeks;
- this.ime = ime;
- this.prezime = prezime;
- this.grad = grad;
- this.ocene = ocene;
- }
- // konstruktor kopije
- public Student(Student original) {
- this.ime=original.ime;
- this.prezime=original.prezime;
- this.grad=original.grad;
- this.indeks=original.indeks;
- this.ocene=original.ocene;
- }
- double izracunajProsek() {
- int zbirOcena=0;
- for(int i=0;i<ocene.length;i++) {
- zbirOcena+=ocene[i];
- }
- return zbirOcena/ocene.length;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement