usflix
Class MovieRating

java.lang.Object
  extended by usflix.MovieRating

public class MovieRating
extends java.lang.Object

MovieRating class manages (movie, rating) pair

Version:
4.0 April 3, 2013.
Author:
EJ Jung

Field Summary
private  Movie movie
           
private  float rating
           
 
Constructor Summary
MovieRating(Movie m, float r)
           
 
Method Summary
 Movie getMovie()
           
 float getRating()
           
 void setRating(float r)
          changes the rating to r
 java.lang.String toString()
          If the user has rated this movie before (rating>0), then return the user's rating.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

movie

private Movie movie

rating

private float rating
Constructor Detail

MovieRating

public MovieRating(Movie m,
                   float r)
Method Detail

toString

public java.lang.String toString()
If the user has rated this movie before (rating>0), then return the user's rating. If the user has not rated this movie (rating==0), then return the average rating. When it returns the average rating, the return value includes (average), e.g. 3.3 (average) so that user knows that user has not rated this movie.

Overrides:
toString in class java.lang.Object
Returns:
user's rating if it exists. Otherwise, the average rating + (average)

getMovie

public Movie getMovie()
Returns:
the Movie object

getRating

public float getRating()
Returns:
the rating

setRating

public void setRating(float r)
changes the rating to r

Parameters:
r -