Pacote br.com.diego.screenmatch.models
Subclasse TVShow
package br.com.diego.screenmatch.models;
public class TVShow extends Title {
int seasons;
public int getSeasons() {
return seasons;
}
public void setSeasons(int seasons) {
this.seasons = seasons;
}
public int getEpisodesPerSeason() {
return episodesPerSeason;
}
public void setEpisodesPerSeason(int episodesPerSeason) {
this.episodesPerSeason = episodesPerSeason;
}
public boolean isActive() {
return active;
}
public void setActive(boolean active) {
this.active = active;
}
public int getMinutesPerEpisode() {
return minutesPerEpisode;
}
public void setMinutesPerEpisode(int minutesPerEpisode) {
this.minutesPerEpisode = minutesPerEpisode;
}
int episodesPerSeason;
boolean active;
int minutesPerEpisode;
@Override
public int movieLength() {
return episodesPerSeason * minutesPerEpisode * seasons;
}
}
Subclasse Main
import br.com.diego.screenmatch.models.Movies;
import br.com.diego.screenmatch.models.TVShow;
import br.com.diego.screenmatch.models.Title;
public class Main extends Title {
public static void main(String[] args) {
Movies myMovie = new Movies();
myMovie.setMovieLength(180);
myMovie.setTitle("The Godfather");
myMovie.setReleaseDate(1970);
System.out.println(myMovie.getTitle());
System.out.println(myMovie.getMovieLength());
System.out.println(myMovie.getReleaseDate());
// myMovie.title = "The Godfather";
// myMovie.releaseDate = 1974;
// myMovie.movieLength = 180;
// myMovie.showFile();
// myMovie.reviewRating(8);
// myMovie.reviewRating(5);
// myMovie.reviewRating(10);
// System.out.println(myMovie.getReview);
// System.out.println(myMovie.getTotalOfReviews());
// System.out.println(myMovie.averageScore());
TVShow theBoys = new TVShow();
theBoys.setTitle("The Boys");
theBoys.setReleaseDate(2015);
theBoys.setActive(true);
theBoys.setSeasons(4);
theBoys.setMinutesPerEpisode(50);
theBoys.setIncludedInThePlan(false);
System.out.println(theBoys.getTitle());
theBoys.showFile();
theBoys.setSeasons(4);
theBoys.setMinutesPerEpisode(50);
theBoys.setEpisodesPerSeason(10);
System.out.println("Duração para maratonar The Boys: " + theBoys.getMovieLength());
}
@Override
public int movieLength() {
return 0;
}
}
Ao compilar a subclasse Main, a duração para maratonar The Boys retorna zero (e a IDE te obriga a inserir mais um override, ali depois do sout Duração para maratonar The Boys, esse mesmo override retorna zero como método)