public class Movie {
private String title, director;
private float overallRating;
private enum showingStatus {ComingSoon, Preview, NowShowing};
public Movie(String title, enum showingStatus, String director)
{
this.title = title;
this.showingStatus = showingStatus;
this.director = director;
overallRating = 0;
}
}
How do I restrict in such a way when someone creates Movie
object, they pass in only my defined list of showingStatus
?
I also want to define the get and set methods but they are throwing errors pointed out on comments
public void setShowingStatus(enum showingStatus){ this.showingStatus = showingStatus;} // showingStatus cannot be resolved or not a field
public String getShowingStatus() { return showingStatus; } // showingStatus cannot be resolved to a variable