-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCD.java
41 lines (36 loc) · 824 Bytes
/
CD.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
35
36
37
38
39
40
41
package uk.ac.aston.oop.javafx.assessed.model;
/**
* The CD class represents a CD object. Information about the CD is stored and
* can be retrieved.
*
*/
public class CD extends Item {
private final String artist;
private final int numberOfTracks;
/**
* Constructor for objects of class CD
*/
public CD(String theTitle, String theArtist, int tracks, int time) {
super(theTitle, time);
artist = theArtist;
numberOfTracks = tracks;
}
/**
* Return the artist for this CD.
*/
public String getArtist() {
return artist;
}
/**
* Return the number of tracks on this CD.
*/
public int getNumberOfTracks() {
return numberOfTracks;
}
@Override
public String toString() {
return String.format(
"Artist: %s. Number of tracks: %d\n%s",
artist, numberOfTracks, super.toString());
}
}