Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

[Dúvida] Problemas com o set

Não estou conseguindo ver porque meu set para a duração do filme não está funcionando, alguém pode me ajudar?

Main:

import locatudo.model.Movie;
import locatudo.model.TvShow;

public class Main {
    public static void main(String[] args) {
        Movie myMovie = new Movie();
        myMovie.setName("Alien");
        myMovie.setReleaseYear(1979);
        myMovie.setDirectorName("Ridley Scott");
        myMovie.setPlanIncluded(true);
        myMovie.setDuration(94);

        myMovie.displaysTechnicalSheet();
        myMovie.assesses(4.8); // Public
        myMovie.assesses(4.5); // Rotten Tomatoes
        myMovie.assesses(4.3); //Letterboxd

        System.out.println("Total rating: " + myMovie.getTotalRating());
        System.out.println(myMovie.average());

        TvShow mySeries = new TvShow();
        mySeries.setName("Breaking Bad");
        mySeries.setReleaseYear(2008);
        mySeries.setDirectorName("Vince Gilligan");
        mySeries.setSeason(5);
        mySeries.setSeasonEps(16);
        mySeries.setMinuteEps(50);
        mySeries.setActivity(true);


        mySeries.displaysTechnicalSheet();
    }
}

Título:

package locatudo.model;

public class Title {
    private String name;
    private int releaseYear;
    private boolean planIncluded = true;
    private double sumOfRating;
    private double totalRating;
    private int duration;

    public int getTotalRating(){
        return (int) totalRating;
    }

    public String getName() {
        return name;
    }


    public int getReleaseYear() {
        return releaseYear;
    }

    public int getDuration() {
        return duration;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setReleaseYear(int releaseYear) {
        this.releaseYear = releaseYear;
    }

    public void setDuration(int duration) {
        this.duration = duration;
    }

    public void setPlanIncluded(boolean planIncluded) {
        this.planIncluded = planIncluded;
    }

    public void displaysTechnicalSheet(){
        System.out.println("Movie: " + name);
        System.out.println("Release year: " + releaseYear);
    }

Filmes:

package locatudo.model;

public class Movie extends Title {
    private String directorName;

    public String getDirectorName() {
        return directorName;
    }

    public void setDirectorName(String directorName) {
        this.directorName = directorName;
    }

}

Series:

package locatudo.model;

public class TvShow extends Title {
    private int season;
    private boolean activity = true;
    private int seasonEps;
    private int minuteEps;
    private String directorName;

    public String getDirectorName() {
        return directorName;
    }

    public int getSeason() {
        return season;
    }

    public boolean isActivity() {
        return activity;
    }

    public int getSeasonEps() {
        return seasonEps;
    }

    public int getMinuteEps() {
        return minuteEps;
    }

    public void setDirectorName(String directorName) {
        this.directorName = directorName;
    }

    public void setSeason(int season) {
        this.season = season;
    }

    public void setActivity(boolean activity) {
        this.activity = activity;
    }

    public void setSeasonEps(int seasonEps) {
        this.seasonEps = seasonEps;
    }

    public void setMinuteEps(int minuteEps) {
        this.minuteEps = minuteEps;
    }
}
1 resposta
solução!

Descobri meu problema, não eu não estava atribuindo valor para o mySeries.setDuration();