2 Star 0 Fork 0

CS-IMIS-23 / 20172311hai

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
DVD.java 2.33 KB
一键复制 编辑 原始数据 按行查看 历史
package test2;
//*******************************************************************************************************************
// DVD.java Author:Lewis/Loftus
// Represents a DVD video disc.
//*******************************************************************************************************************
import java.text.NumberFormat;
public class DVD {
private String title, director;
private int year;
private double cost;
private boolean bluray;
//----------------------------------------------------------------------------------------------------------------
// Creates a new DVD with the specified information.
//----------------------------------------------------------------------------------------------------------------
public DVD(String title, String director, int year, double cost,
boolean bluray)
{
this.title = title;
this.director = director;
this.year = year;
this.cost = cost;
this.bluray = bluray;
}
//----------------------------------------------------------------------------------------------------------------
// Returns a string description of this DVD.
//----------------------------------------------------------------------------------------------------------------
public String toString() {
NumberFormat fmt = NumberFormat.getCurrencyInstance();
String description;
description = fmt.format(cost) + "\t" + year + "\t";
description += title + "\t" + director;
if (bluray)
description += "\t" + "Blu-ray";
return description;
}
//构造getter和setter
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 getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public double getCost() {
return cost;
}
public void setCost(double cost) {
this.cost = cost;
}
public boolean isBluray() {
return bluray;
}
public void setBluray(boolean bluray) {
this.bluray = bluray;
}
}
Java
1
https://gitee.com/CS-IMIS-23/20172311hai.git
git@gitee.com:CS-IMIS-23/20172311hai.git
CS-IMIS-23
20172311hai
20172311hai
master

搜索帮助