-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsongsAndArtists.java
57 lines (49 loc) · 1.59 KB
/
songsAndArtists.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
Fabella, Euge Kyle
BSIT301A
Data Structures and Algorithms
*/
import java.util.LinkedList;
public class songsAndArtists
{
public static void main(String[] args)
{
//creating LinkedLists
LinkedList songs = new LinkedList();
LinkedList artists = new LinkedList();
LinkedList playlist = new LinkedList();
//adding songs to the LinkedList 'songs'
songs.add("Yuri on Ice");
songs.add("History Maker");
songs.add("You Only Live Once");
songs.add("Re:frain");
songs.add("Yoku");
//adding artists to the LinkedList 'artists'
artists.add("Taro Umbayashi");
artists.add("Dean Fujioka");
artists.add("Wataru Hatano");
artists.add("Aimer");
artists.add("Eve");
//showing what's inside the LinkedList 'songs' and 'artists'
line();
System.out.println(songs);
System.out.println(artists);
line();
//in this 'for loop', it will add the contents of 'songs' and 'artists' to the LinkedList 'playlist'
for (int i = 0; i < songs.size(); i++)
{
playlist.add(songs.get(i) + " - " + artists.get(i));
}
//and lastly, it will print out its contents (playlist)
for (int i = 0; i < playlist.size(); i++)
{
System.out.println(playlist.get(i));
}
line();
}
//separator
public static void line()
{
System.out.println("------------------------------------------------------------------");
}
}