Ai
2 Star 0 Fork 0

CS-IMIS-23/20172309_javaProgramming

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
DVD.java 1.14 KB
一键复制 编辑 原始数据 按行查看 历史
20172309 提交于 2018-05-19 11:25 +08:00 . PP13.1 DVD
package chapter13;
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;
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/CS-IMIS-23/20172309_javaProgramming.git
git@gitee.com:CS-IMIS-23/20172309_javaProgramming.git
CS-IMIS-23
20172309_javaProgramming
20172309_javaProgramming
master

搜索帮助