Exemplo n.º 1
0
 //#############################################
 //#############################################
 private static CD addCD()
 {
     int nSongs;
     CD tmpCD = new CD();
     List<Song> tmpSongList = new List<Song>();
     Console.Clear();
     cout("CD Name: ");
     tmpCD.setName(Console.ReadLine());
     cout("CD Year: ");
     tmpCD.setYear(validateNumInput(Console.ReadLine()));
     cout("Number of Songs: ");
     nSongs = validateNumInput(Console.ReadLine());
     for (int i = 1; i < nSongs+1; i++ ) {
         Song tmpSong = new Song();
         String songName, tmpString2;
         Artist tmpArtist = new Artist();
         int tmpI0;
         cout(i + ". Song:\n");
         cout("\tSongname: ");
         songName = Console.ReadLine();
         cout("\tGenre: ");
         tmpString2 = Console.ReadLine();
         cout("\tArtist: ");
         tmpArtist.setName(Console.ReadLine());
         cout("\tSonglength in seconds: ");
         tmpI0 = validateNumInput(Console.ReadLine());
         tmpSong = new Song(songName, tmpI0, tmpArtist, tmpString2);
         tmpSongList.Add(tmpSong);
     }
     tmpCD.setSongs(tmpSongList);
     return tmpCD;
 }