movie class

mail@pastecode.io avatar
unknown
plain_text
7 months ago
993 B
3
Indexable
Never
//mutators and accessors//
//class used to define object//
public class Movie {
    private String movName; 
    private String movGenre;
    private int movRating;

    public Movie(String name, String genre, int rating) {
        this.movName = name;
        this.movGenre = genre;
        this.movRating = rating;
    }

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

    public String getName() {
        return movName;
    }

    public void setGenre(String genre) {
        this.movGenre = genre;
    }

    public String getGenre() {
        return movGenre;
    }

    public void setRating(int rating) {
        this.movRating = rating;
    }

    public int getRating() {
        return movRating;
    }

    public void print() {
        System.out.println("Movie Name: " + movName);
        System.out.println("Genre: " + movGenre);
        System.out.println("Rating: " + movRating);
        System.out.println("___________________________");
    }
}
Leave a Comment