-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCD.java
More file actions
35 lines (30 loc) · 917 Bytes
/
CD.java
File metadata and controls
35 lines (30 loc) · 917 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
32
33
34
35
public class CD extends Playable {
private String artist;
/**
* Create a new playable product.
*
* @param price The price of the product in pounds.
* @param numStock The amount of the product in stock.
* @param runtime The runtime of the product.
* @param title The title of the product.
*/
public CD(double price, int numStock, double runtime, String title,String artist) {
super(price, numStock, runtime, title);
setArtist(artist);
}
@Override
public void play() {
play =! play;
if(play){
System.out.println("The song is playing");
} else{
System.out.println("the song is not playing");
}
}
public String getArtist() {
return artist;
}
public void setArtist(String artist) {
this.artist = artist;
}
}