Advertisement
techno-

MovieRating.java

Oct 4th, 2022
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1. package Movie;
  2.  
  3. enum MovieRating {
  4.     NOT_RATED,
  5.     AWFUL(0),
  6.     BAD(2),
  7.     MEDIOCRE(4),
  8.     GOOD(6),
  9.     EXCELLENT(8),
  10.     MASTERPIECE(10);
  11.     private final int puntuacion;
  12.     public int  getNumericRating() {
  13.         return puntuacion;
  14.     }
  15.     private MovieRating(int puntuacion) {
  16.         this.puntuacion = puntuacion;
  17.     }
  18.     private MovieRating() {
  19.         this.puntuacion = -1;
  20.     }
  21.  
  22.     MovieRating mr;
  23.  
  24.     public boolean isBetterThan(MovieRating mr){
  25.         if(this.getNumericRating() > mr.getNumericRating() || mr == MovieRating.NOT_RATED){
  26.             return true;
  27.         }else return false;
  28.     }
  29. } ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement