So I have a class called MusicSelection and I must create 2 ArrayLists of MusicSelection with 5 string parameters. I have the list of 100 strings from a .txt file stored in play. I need to create 20 MusicSelection objects using these 100 strings and store them in lib. But I am having the hardest time figuring out how to do this. Please help. Thank you!
public class MusicSelection {
String g;
String a;
String t;
String al;
String d;
public MusicSelection (String genre, String artist, String title, String album, String date){
g = genre;
a = artist;
t = title;
al = album;
d = date;
}
public static void main(String[] args) {
Scanner play = null;
int choice = 0;
Scanner input = new Scanner(System.in);
ArrayList<MusicSelection> lib = new ArrayList();
ArrayList<MusicSelection> plist = new ArrayList();
System.out.println("Welcome to the playlist creator!");
while(choice!=5){
System.out.println("Please make a choice");
System.out.println("1: Create playlist");
System.out.println("2: Delete playlist");
System.out.println("3: Add selection to playlist");
System.out.println("4: Remove seletion from playlist");
System.out.println("5: Quit");
choice = input.nextInt();
if (choice==1&&play==null){
try
{
play =new Scanner(new FileInputStream("lisst.txt"));
}
catch(FileNotFoundException e)
{
System.out.println("Problem opening files.");
System.exit(0);
}
while(play.hasNextLine()){
}