** * 任务:实现一个电影类 * 类名为:Movie */// 请在下面的Begin-End之间按照注释中给出的提示编写正确的代码/********** Begin **********/public class Movie {…
时间: 2023-11-14 07:08:35 浏览: 204
HTML.rar_/movie/28323.html_HBuilder_movie/index.html_电影类网站
代码实现如下:
/********** Begin **********/
public class Movie {
private String title; // 电影名称
private String director; // 导演
private int releaseYear; // 上映年份
private double rating; // 评分
public Movie(String title, String director, int releaseYear, double rating) {
this.title = title;
this.director = director;
this.releaseYear = releaseYear;
this.rating = rating;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDirector() {
return director;
}
public void setDirector(String director) {
this.director = director;
}
public int getReleaseYear() {
return releaseYear;
}
public void setReleaseYear(int releaseYear) {
this.releaseYear = releaseYear;
}
public double getRating() {
return rating;
}
public void setRating(double rating) {
this.rating = rating;
}
}
/********** End **********/
阅读全文