Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.26 KB | None | 0 0
  1.  
  2.  
  3. public class GOTEpizoda implements OPoredivo {
  4.     int sezona, epizoda, brojGledalaca;
  5.     String naziv, reditelj;
  6.  
  7.     public GOTEpizoda() {
  8.         sezona = 1;
  9.         epizoda = 1;
  10.         naziv = "Winter is coming";
  11.         reditelj = "Tim Van Pattern"
  12.         brojGledalaca = 2220000;
  13.     }
  14.  
  15.     public GOTEpizoda(int sezona, int epizoda, int brojGledalaca, String naziv, String reditelj) {
  16.         this.sezona = sezona;
  17.         this.epizoda = epizoda;
  18.         this.brojGledalaca = brojGledalaca;
  19.         this.naziv = naziv;
  20.         this.reditelj = reditelj;
  21.     }
  22.  
  23.     GOTEpizoda(GOTEpizoda ep) {
  24.         this.sezona = ep.sezona;
  25.         this.epizoda = ep.epizoda;
  26.         this.brojGledalaca = ep.brojGledalaca;
  27.         this.naziv = ep.naziv;
  28.         this.reditelj = ep.reditelj;
  29.     }
  30.  
  31.     @Override
  32.     public String toString() {
  33.         return String.format("%s S%2d/E%2d %f - %s", naziv, sezona, epizoda, brojGledalaca/1000000, reditelj);
  34.     }
  35.  
  36.     @Override
  37.     public uporedi(Object t) {
  38.         if(GOTEpizoda.brojGledalaca > t.brojGledalaca) {
  39.             return true;
  40.         } else if(GOTEpizoda.brojGledalaca < t.brojGledalaca) {
  41.             return false;
  42.         } else {
  43.             return epizoda < t.epizoda;
  44.         }
  45.     }
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement