-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCD.java
More file actions
31 lines (26 loc) · 787 Bytes
/
CD.java
File metadata and controls
31 lines (26 loc) · 787 Bytes
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
package dome;
public class CD extends Item{
private String artist;
private int numofTracks;
private String label;
public CD(String title, String artist, int numofTracks, int playingTime, String label) {
super(title,playingTime,false); //从父类中得到title的值
// this.title = title;
this.artist = artist;
this.numofTracks = numofTracks;
this.label = label;
// this.playingTime = playingTime;
// this.label = label;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
CD cd = new CD("Stone Cafe", "Leah Dou", 11, 43, "Gray Waters");
cd.print();
}
public void print() {
// TODO Auto-generated method stub
System.out.print("CD:");
super.print();
System.out.println(" | "+artist);
}
}