-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDVD.java
34 lines (33 loc) · 1.12 KB
/
DVD.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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;
}
}