Skip to content

Commit ef2b7e2

Browse files
committed
fix: correctly implemented work into lesson 16
1 parent 5694715 commit ef2b7e2

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
package com.codedifferently.lesson16.justinsplaylist;
1+
package com.codedifferently.lesson16.justins_playlist;
22

33
import java.util.ArrayList;
44
import java.util.List;
55

6-
public class playlist {
6+
public class Playlist {
77
private String name;
88
private String genre;
99
private int duration;
1010
private List<String> songs;
1111

12-
public playlist(String name, String genre, int duration) {
12+
public Playlist(String name, String genre, int duration) {
1313
this.name = name;
1414
this.genre = genre;
1515
this.duration = duration;
@@ -30,7 +30,14 @@ public String getDetails() {
3030
return "Name: " + name + ", Genre: " + genre + ", Duration: " + duration;
3131
}
3232

33-
34-
35-
33+
public void addSong(String song) {
34+
if (song == null || song.isEmpty()) {
35+
throw new IllegalArgumentException("Song cannot be null or empty");
36+
}
37+
songs.add(song);
38+
}
39+
40+
public List<String> getSongs() {
41+
return songs;
42+
}
3643
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.codedifferently.lesson16.JustinsPylaylist;
1+
package com.codedifferently.lesson16.justins_playlist;
22

33
import java.util.ArrayList;
44
import java.util.List;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
public class PlaylistTest {
99

10-
private playlist playlist;
10+
private Playlist playlist;
1111

1212
@BeforeEach
1313
public void setUp() {

0 commit comments

Comments
 (0)