Exemple #1
0
        private static async Task InsertTestData(IServiceProvider serviceProvider)
        {
            var albums = GetAlbums(imgUrl, Genres, Artists);

            await AddOrUpdateAsync(serviceProvider, g => g.GenreId, Genres.Select(genre => genre.Value));
            await AddOrUpdateAsync(serviceProvider, a => a.ArtistId, Artists.Select(artist => artist.Value));
            await AddOrUpdateAsync(serviceProvider, a => a.AlbumId, albums);
        }
Exemple #2
0
        public void PopulateOptionLists()
        {
            Groupings = Artists.Select(a => a.Grouping).Distinct().OrderBy(g => g).ToList();

            Genres = Artists.Select(a => a.Genre).Distinct().OrderBy(g => g).ToList();

            _usedCities = Artists.Select(a => a.City).Where(c => c != null).Distinct().ToList();

            Countries = _usedCities.Select(c => c.Country).Distinct().OrderBy(c => c).ToList();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            Init();// this method fills the arrays above with data

            /*
             *  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
             *  ░░░░░░░░░░░░░░░░░░░░░░████████░░░░░░░░░
             *  ░░███████░░░░░░░░░░███▒▒▒▒▒▒▒▒███░░░░░░
             *  ░░█▒▒▒▒▒▒█░░░░░░░███▒▒▒▒▒▒▒▒▒▒▒▒███░░░░
             *  ░░░█▒▒▒▒▒▒█░░░░██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██░░
             *  ░░░░█▒▒▒▒▒█░░░██▒▒▒▒▄██▄▒▒▒▒▄██▄▒▒▒███░
             *  ░░░░░█▒▒▒█░░░█▒▒▒▒▒▒████▒▒▒▒████▒▒▒▒▒██
             *  ░░░█████████████▒▒▒▒▀██▀▒▒▒▒▀██▀▒▒▒▒▒██
             *  ░░░█▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒▒▒▒▒██
             *  ░██▒▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒██▒▒▒▒▒▒▒▒▒██▒▒▒▒██
             *  ██▒▒▒███████████▒▒▒▒▒██▒▒▒▒▒▒▒██▒▒▒▒▒██
             *  █▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒███████▒▒▒▒▒▒▒██
             *  ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██░
             *  ░█▒▒▒███████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██░░░
             *  ░██▒▒▒▒▒▒▒▒▒▒▒███▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█░░░░░
             *  ░░████████████░░░████████████████░░░░░░
             *  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
             *  ░░▄█████▄░▄███████▄░▄███████▄░██████▄░░
             *  ░░██▒▒▒▒█░███▒▒▒███░███▒▒▒███░██▒▒▒██░░
             *  ░░██▒▒▒▒▒░██▒▒▒▒▒██░██▒▒▒▒▒██░██▒▒▒██░░
             *  ░░██▒▒▒▀█░███▒▒▒███░███▒▒▒███░██▒▒▒██░░
             *  ░░▀█████▀░▀███████▀░▀███████▀░██████▀░░
             *  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
             *  ░░░░██▒▒▒▒░██▒▒▒██░▄█████░██▒▒▒▒██▀░░░░
             *  ░░░░██▒▒▒▒░██▒▒▒██░██▀▒▒▒░██▒▒▒██░░░░░░
             *  ░░░░██▒▒▒▒░██▒▒▒██░██▒▒▒▒░█████▀░░░░░░░
             *  ░░░░██▒▒▒▒░██▄▒▄██░██▄▒▒▒░██▒▒▒██░░░░░░
             *  ░░░░▀█████░▀█████▀░▀█████░██▒▒▒▒██▄░░░░
             *  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
             */

            //1 - how many Songs start with the letter 'a' (case insensitive)
            Console.WriteLine("Songs start with the letter 'a'");
            var songsWithA = Songs
                             .Where(x => x.Name.StartsWith("a"))
                             .ToList();

            Console.WriteLine(string.Join(" ", songsWithA));
            Console.WriteLine("-----------------------------------------");

            //2 - how many artists end with letter 'a' (case insensitive)
            Console.WriteLine("Artists end with letter 'a'");
            var artistEnd = Artists
                            .Where(x => x.FullName.EndsWith("a"))
                            .ToList();

            foreach (var item in artistEnd)
            {
                Console.WriteLine(item.FullName);
            }
            Console.WriteLine("-----------------------------------------");

            //3 - whats the name of the song with longest duration
            Console.WriteLine("Longest Song by Duration:");
            var longestSong = Songs
                              .OrderByDescending(x => x.Duration)
                              .First();

            Console.WriteLine(longestSong.Name);
            Console.WriteLine("-----------------------------------------");

            //4 - whats the total Duration of all Songs
            Console.WriteLine("Total Duration of all Songs:");
            var totalDuration = Songs
                                .Sum(x => x.Duration);

            Console.WriteLine($"{totalDuration} seconds");
            Console.WriteLine("-----------------------------------------");

            //5 - how many albums have Songs longer than 300 seconds
            Console.WriteLine("Albums with Songs longer than 300 seconds");
            var albums300 = Albums
                            .Where(x => x.Songs.Any(y => y.Duration > 300));

            foreach (var item in albums300)
            {
                Console.WriteLine(item.Name);
            }
            Console.WriteLine("-----------------------------------------");

            //6 - print the names of the artists(separated with "--"), that have more than one album of PopRock genre
            Console.WriteLine("Artists with more than one album of PopRock Genre:");
            var popRock = Artists
                          .Select(x => new { NameOfArtist = x.FullName, AlbumsOfArtist = x.Albums.Where(y => y.Genre == Genre.PopRock).Count() })
                          .Where(k => k.AlbumsOfArtist > 1);

            foreach (var item in popRock)
            {
                Console.Write(item.NameOfArtist + "--");
            }
            Console.WriteLine();
            Console.WriteLine("-----------------------------------------");

            //7 - print the name of the album that has highest Average duration of a song
            Console.WriteLine("Albums with highest Average duration of a song:");
            var durationAvg = Albums
                              .Select(x => new { NameOfAlbum = x.Name, AvgDuration = x.Songs.Average(y => y.Duration) })
                              .OrderByDescending(w => w.AvgDuration)
                              .First();

            Console.WriteLine($"Name: {durationAvg.NameOfAlbum}, Highest Average duration: {durationAvg.AvgDuration}");
            Console.WriteLine("-----------------------------------------");

            //8 - how many characters has the song that has the shortest Duration
            Console.WriteLine("Characters of the shortest duration song:");
            var shortestDuration = Songs
                                   .OrderByDescending(x => x.Duration)
                                   .Reverse()
                                   .First();

            Console.WriteLine($"Name: {shortestDuration.Name}, Characters: {shortestDuration.Name.Length}, Duration: {shortestDuration.Duration}");
            Console.WriteLine("-----------------------------------------");

            //9 - print the name and the genre of the album that has most songs
            Console.WriteLine("Album with most songs:");
            var mostSongsAlbum = Albums
                                 .Select(x => new { SongCount = x.Songs.Count, NameOfAlbum = x.Name, GenreOfAlbum = x.Genre })
                                 .OrderByDescending(w => w.SongCount)
                                 .First();

            Console.WriteLine($"Name: {mostSongsAlbum.NameOfAlbum}, Song Count: {mostSongsAlbum.SongCount}, Genre: {mostSongsAlbum.GenreOfAlbum}");
            Console.WriteLine("-----------------------------------------");

            //10 - print the name of the artist that has most songs
            Console.WriteLine("Artist with most songs:");
            var artistMostSongs = Artists
                                  .Select(x => new { NameOfArtist = x.FullName, SongsOfArtist = x.Albums.Sum(y => y.Songs.Count) })
                                  .OrderByDescending(a => a.SongsOfArtist)
                                  .First();

            Console.WriteLine($"Artist: {artistMostSongs.NameOfArtist}, Songs Count: {artistMostSongs.SongsOfArtist}");
            Console.WriteLine("-----------------------------------------");

            //11 - print the type of the artist(SoloArtist/Band) that has most albums published before year 2000
            Console.WriteLine("Artist that has most albums published before year 2000:");
            var artist2000 = Artists
                             .Select(x => new { NameOfArtist = x.FullName, AlbumsCount = x.Albums.Select(y => y.Year < 2000).Count() })
                             .OrderByDescending(a => a.AlbumsCount)
                             .First();

            Console.WriteLine($"Artist: {artist2000.NameOfArtist}");
            Console.WriteLine("-----------------------------------------");

            //12 - print the average song duration, of the album that has most songs
            Console.WriteLine("Average song duration of the album that has most songs:");
            var albumAverageDuration = Albums
                                       .Select(x => new { NameOfAlbum = x.Name, MostSongs = x.Songs.Count(), AverageDuration = x.Songs.Average(d => d.Duration) })
                                       .OrderByDescending(o => o.MostSongs)
                                       .First();

            Console.WriteLine($"Album Name: {albumAverageDuration.NameOfAlbum}, Songs Count: {albumAverageDuration.MostSongs}, Average Duration: {albumAverageDuration.AverageDuration} seconds");
            Console.WriteLine("-----------------------------------------");

            // Bonus:
            //13 - print the longest song duration of the album that has least songs
            Console.WriteLine("Longest song duration of the album that has least songs:");
            var longestSongDuration = Albums
                                      .OrderBy(x => x.Songs.Count)
                                      .Select(s => new { Song = s.Songs.OrderByDescending(s1 => s1.Duration).First(), AlbumName = s.Name, AlbumSongs = s.Songs.Count() })
                                      .First();

            Console.WriteLine($"Song Name: {longestSongDuration.Song.Name}, Song Duration: {longestSongDuration.Song.Duration} seconds, Album Name: {longestSongDuration.AlbumName}, Album Songs: {longestSongDuration.AlbumSongs}");
            Console.WriteLine("-----------------------------------------");

            //14 - print the name of the album that has most songs that contain letter 'a' in the name
            Console.WriteLine("Name of the Album that has most songs that contain letter 'a' in the name:");
            var songsThatContainA = Albums
                                    .Select(x => new { AlbumName = x.Name, ContainA = x.Songs.Where(y => y.Name.Contains("a")).Count() })
                                    .OrderByDescending(x => x.ContainA)
                                    .First();

            Console.WriteLine($"Album Name: {songsThatContainA.AlbumName}, Songs count that contain 'a': {songsThatContainA.ContainA}");
            Console.WriteLine("-----------------------------------------");

            //15 - print the name of the artist that has most songs that end with letter 'd'
            Console.WriteLine("Name of the artist that has most songs that end with letter 'd':");
            var maxSongsWithD   = 0;
            var artistNameWithD = String.Empty;

            foreach (var album in Albums)
            {
                var songsWithD = album.Songs.Where(s => s.Name.EndsWith("d")).Count();
                if (songsWithD > maxSongsWithD)
                {
                    maxSongsWithD   = songsWithD;
                    artistNameWithD = Artists.Where(x => x.Id == album.ArtistId).Select(x => x.FullName).FirstOrDefault();
                }
            }
            Console.WriteLine($"{artistNameWithD} has most songs that ends with 'd'");
            Console.WriteLine("-----------------------------------------");
            Console.ReadLine();
        }
Exemple #4
0
        static void Main(string[] args)
        {
            Init();// this method fills the arrays above with data

            // - print the mass of the earth on July 1895 XD

            /*
             *  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
             *  ░░░░░░░░░░░░░░░░░░░░░░████████░░░░░░░░░
             *  ░░███████░░░░░░░░░░███▒▒▒▒▒▒▒▒███░░░░░░
             *  ░░█▒▒▒▒▒▒█░░░░░░░███▒▒▒▒▒▒▒▒▒▒▒▒███░░░░
             *  ░░░█▒▒▒▒▒▒█░░░░██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██░░
             *  ░░░░█▒▒▒▒▒█░░░██▒▒▒▒▄██▄▒▒▒▒▄██▄▒▒▒███░
             *  ░░░░░█▒▒▒█░░░█▒▒▒▒▒▒████▒▒▒▒████▒▒▒▒▒██
             *  ░░░█████████████▒▒▒▒▀██▀▒▒▒▒▀██▀▒▒▒▒▒██
             *  ░░░█▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒▒▒▒▒██
             *  ░██▒▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒██▒▒▒▒▒▒▒▒▒██▒▒▒▒██
             *  ██▒▒▒███████████▒▒▒▒▒██▒▒▒▒▒▒▒██▒▒▒▒▒██
             *  █▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒███████▒▒▒▒▒▒▒██
             *  ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██░
             *  ░█▒▒▒███████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██░░░
             *  ░██▒▒▒▒▒▒▒▒▒▒▒███▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█░░░░░
             *  ░░████████████░░░████████████████░░░░░░
             *  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
             *  ░░▄█████▄░▄███████▄░▄███████▄░██████▄░░
             *  ░░██▒▒▒▒█░███▒▒▒███░███▒▒▒███░██▒▒▒██░░
             *  ░░██▒▒▒▒▒░██▒▒▒▒▒██░██▒▒▒▒▒██░██▒▒▒██░░
             *  ░░██▒▒▒▀█░███▒▒▒███░███▒▒▒███░██▒▒▒██░░
             *  ░░▀█████▀░▀███████▀░▀███████▀░██████▀░░
             *  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
             *  ░░░░██▒▒▒▒░██▒▒▒██░▄█████░██▒▒▒▒██▀░░░░
             *  ░░░░██▒▒▒▒░██▒▒▒██░██▀▒▒▒░██▒▒▒██░░░░░░
             *  ░░░░██▒▒▒▒░██▒▒▒██░██▒▒▒▒░█████▀░░░░░░░
             *  ░░░░██▒▒▒▒░██▄▒▄██░██▄▒▒▒░██▒▒▒██░░░░░░
             *  ░░░░▀█████░▀█████▀░▀█████░██▒▒▒▒██▄░░░░
             *  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
             */

            // QUERIES!

            // - how many Songs start with the letter 'a' (case insensitive)
            // - how many artists end with letter 'a' (case insensitive)
            // - whats the name of the song with longest duration
            // - whats the total Duration of all Songs
            // - how many albums have Songs longer than 300 seconds
            // - print the names of the artists(separated with "--"), that have more than one album of PopRock genre
            // - print the name of the album that has highest Average duration of a song
            // - how many characters has the song that has the shortest Duration
            // - print the name and the genre of the album that has most songs
            // - print the name of the artist that has most songs
            // - print the type of the artist(SoloArtist/Band) that has most albums published before year 2000
            // - print the average song duration, of the album that has most songs

            // Bonus:
            // - print the longest song duration of the album that has least songs
            // - print the name of the album that has most songs that contain letter 'a' in the name
            // - print the name of the artist that has most songs that end with letter 'd'



            // ************ Don't mind the structure, focus on the lists declared on the beginning of Program.cs ****************

            // 3, 2, 1.... GO! :)

            //How many Songs start with the letter 'a'(case insensitive)  ?????????????????????????
            Console.WriteLine("1.How many Songs start with the letter 'a'(case insensitive)");
            List <Song> songsStartWithA = Songs
                                          .Where(song => song.Name.ToLower()
                                                 .StartsWith("a"))
                                          .ToList();

            Console.WriteLine(songsStartWithA.Count);

            //How many artists end with letter 'a'(case insensitive)
            Console.WriteLine("2.How many artists end with letter 'a'(case insensitive)");
            List <Artist> songsEndWithA = Artists
                                          .Where(song => song.FullName.ToLower()
                                                 .EndsWith("a"))
                                          .ToList();

            Console.WriteLine(songsEndWithA.Count);

            //Whats the name of the song with longest duration
            Console.WriteLine("3.Whats the name of the song with longest duration");
            Song longestSong = Songs
                               .FirstOrDefault(song => song.Duration == Songs
                                               .Select(s => s.Duration)
                                               .Max());

            Console.WriteLine($"{longestSong.Name}");

            // whats the total Duration of all Songs
            Console.WriteLine("4.Whats the total Duration of all Songs");
            int totalDurationSong = Songs
                                    .Select(s => s.Duration)
                                    .Sum();

            Console.WriteLine(totalDurationSong);

            // how many albums have Songs longer than 300 seconds
            Console.WriteLine("5.how many albums have Songs longer than 300 seconds");
            int songsLonger = Albums
                              .Where(a => a.Songs
                                     .Any(s => s.Duration > 300))
                              .Count();

            Console.WriteLine(songsLonger);


            // Print the names of the artists separated with --, that have more than one album of PopRock genre
            Console.WriteLine("6.Print the names of the artists separated with --, that have more than one album of PopRock genre");
            List <string> namesPopRockArtists = Artists
                                                .Where(x => x.Albums.Count > 1)
                                                .Where(artist => artist.Albums
                                                       .Any(album => album.Genre == Genre.PopRock))
                                                .Select(n => n.FullName)
                                                .ToList();

            namesPopRockArtists.ForEach(artist => Console.Write($"{artist} -- "));
            Console.WriteLine("\n");

            //Print the name of the album that has highest Average duration of a song
            Console.WriteLine("7.Print the name of the album that has highest Average duration of a song");
            Album higestAverage = Albums
                                  .FirstOrDefault(album => album.Songs
                                                  .Select(song => song.Duration).Average() == Albums
                                                  .Select(a => a.Songs
                                                          .Select(s => s.Duration).Average())
                                                  .Max());

            Console.WriteLine(higestAverage.Name);

            //how many characters has the song that has the shortest Duration
            Console.WriteLine("8.how many characters has the song that has the shortest Duration");
            Song songChar = Songs
                            .FirstOrDefault(song => song.Duration == Songs
                                            .Select(s => s.Duration)
                                            .Min());

            Console.WriteLine(songChar.Name.Count());

            //print the name and the genre of the album that has most songs
            Console.WriteLine("9.Print the name and the genre of the album that has most songs");
            Album genreMostSongsAlbum = Albums
                                        .FirstOrDefault(album => album.Songs.Count == Albums
                                                        .Select(a => a.Songs.Count)
                                                        .Max());

            Console.WriteLine($"{genreMostSongsAlbum.Name} - Genre:{genreMostSongsAlbum.Genre}");

            //print the name of the artist that has most songs
            Console.WriteLine("10.Print the name of the artist that has most songs");
            Artist mostSongs = Artists
                               .FirstOrDefault(artist => artist.Albums
                                               .Select(album => album.Songs.Count).Sum() == Artists
                                               .Select(a => a.Albums
                                                       .Select(al => al.Songs.Count).Sum())
                                               .Max());

            Console.WriteLine($"{mostSongs.FullName}");

            // Print the type of the artist(SoloArtist/Band) that has most albums published before year 2000
            Console.WriteLine("11.Print the type of the artist(SoloArtist / Band) that has most albums published before year 2000");
            Artist mostOldAlbums = Artists
                                   .FirstOrDefault(artist => artist.Albums.Count(al => al.Year < 2000) == Artists
                                                   .Select(a => a.Albums.Count(alb => alb.Year < 2000))
                                                   .Max());

            Console.WriteLine($"Name: {mostOldAlbums.FullName} - type: {mostOldAlbums.ArtistType}");

            //Print the average song duration, of the album that has most songs
            Console.WriteLine("12. Print the average song duration, of the album that has most songs");
            double songAverageDuration = Albums
                                         .FirstOrDefault(album => album.Songs.Count == Albums
                                                         .Select(a => a.Songs.Count)
                                                         .Max())
                                         .Songs
                                         .Select(song => song.Duration)
                                         .Average();

            Console.WriteLine(songAverageDuration);

            //Print the longest song duration of the album that has least songs
            Console.WriteLine("13.Print the longest song duration of the album that has least songs");
            Song longestSongDuration = Albums
                                       .FirstOrDefault(album => album.Songs.Count == Albums.Select(alb => alb.Songs.Count)
                                                       .Min())
                                       .Songs.FirstOrDefault(song => song.Duration == Albums
                                                             .Where(al => al.Songs.Count() == Albums
                                                                    .Select(s => s.Songs.Count())
                                                                    .Min())
                                                             .FirstOrDefault().Songs.Select(sg => sg.Duration)
                                                             .Max());

            Console.WriteLine($"Name: {longestSongDuration.Name}, Duration: {longestSongDuration.Duration}");

            //Print the name of the album that has most songs that contain letter 'a' in the name
            Console.WriteLine("14.Print the name of the album that has most songs that contain letter 'a' in the name");
            Album songsMostA = Albums
                               .FirstOrDefault(album => album.Songs
                                               .Where(song => song.Name.ToLower().Contains('a')).Count() == Albums
                                               .Select(al => al.Songs
                                                       .Where(s => s.Name.ToLower().Contains('a')).Count())
                                               .Max());

            Console.WriteLine($"Album name: {songsMostA.Name}");

            //Print the name of the artist that has most songs that end with letter 'd'
            Console.WriteLine("15.Print the name of the artist that has most songs that end with letter 'd'");
            Artist songsEndsD = Artists
                                .FirstOrDefault(artist => artist.Albums
                                                .Select(album => album.Songs
                                                        .Where(song => song.Name.ToLower().EndsWith('d')).Count()).Sum() == Artists
                                                .Select(ar => ar.Albums
                                                        .Select(al => al.Songs
                                                                .Where(s => s.Name.ToLower().EndsWith('d')).Count())
                                                        .Sum())
                                                .Max());

            Console.WriteLine($"Name of the artist: {songsEndsD.FullName}'");

            Console.ReadLine();
        }
Exemple #5
0
 public string GetArtists()
 {
     return(string.Join(", ", Artists.Select(a => a.Name)));
 }
Exemple #6
0
        static void Main(string[] args)
        {
            Init();// this method fills the arrays above with data

            // - print the mass of the earth on July 1895 XD

            /*
             *  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
             *  ░░░░░░░░░░░░░░░░░░░░░░████████░░░░░░░░░
             *  ░░███████░░░░░░░░░░███▒▒▒▒▒▒▒▒███░░░░░░
             *  ░░█▒▒▒▒▒▒█░░░░░░░███▒▒▒▒▒▒▒▒▒▒▒▒███░░░░
             *  ░░░█▒▒▒▒▒▒█░░░░██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██░░
             *  ░░░░█▒▒▒▒▒█░░░██▒▒▒▒▄██▄▒▒▒▒▄██▄▒▒▒███░
             *  ░░░░░█▒▒▒█░░░█▒▒▒▒▒▒████▒▒▒▒████▒▒▒▒▒██
             *  ░░░█████████████▒▒▒▒▀██▀▒▒▒▒▀██▀▒▒▒▒▒██
             *  ░░░█▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒▒▒▒▒██
             *  ░██▒▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒██▒▒▒▒▒▒▒▒▒██▒▒▒▒██
             *  ██▒▒▒███████████▒▒▒▒▒██▒▒▒▒▒▒▒██▒▒▒▒▒██
             *  █▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒███████▒▒▒▒▒▒▒██
             *  ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██░
             *  ░█▒▒▒███████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██░░░
             *  ░██▒▒▒▒▒▒▒▒▒▒▒███▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█░░░░░
             *  ░░████████████░░░████████████████░░░░░░
             *  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
             *  ░░▄█████▄░▄███████▄░▄███████▄░██████▄░░
             *  ░░██▒▒▒▒█░███▒▒▒███░███▒▒▒███░██▒▒▒██░░
             *  ░░██▒▒▒▒▒░██▒▒▒▒▒██░██▒▒▒▒▒██░██▒▒▒██░░
             *  ░░██▒▒▒▀█░███▒▒▒███░███▒▒▒███░██▒▒▒██░░
             *  ░░▀█████▀░▀███████▀░▀███████▀░██████▀░░
             *  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
             *  ░░░░██▒▒▒▒░██▒▒▒██░▄█████░██▒▒▒▒██▀░░░░
             *  ░░░░██▒▒▒▒░██▒▒▒██░██▀▒▒▒░██▒▒▒██░░░░░░
             *  ░░░░██▒▒▒▒░██▒▒▒██░██▒▒▒▒░█████▀░░░░░░░
             *  ░░░░██▒▒▒▒░██▄▒▄██░██▄▒▒▒░██▒▒▒██░░░░░░
             *  ░░░░▀█████░▀█████▀░▀█████░██▒▒▒▒██▄░░░░
             *  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
             */

            // QUERIES!

            // - how many Songs start with the letter 'a' (case insensitive)
            // - how many artists end with letter 'a' (case insensitive)
            // - whats the name of the song with longest duration
            // - whats the total Duration of all Songs
            // - how many albums have Songs longer than 300 seconds
            // - print the names of the artists(separated with "--"), that have more than one album of PopRock genre
            // - print the name of the album that has highest Average duration of a song
            // - how many characters has the song that has the shortest Duration
            // - print the name and the genre of the album that has most songs
            // - print the name of the artist that has most songs
            // - print the type of the artist(SoloArtist/Band) that has most albums published before year 2000
            // - print the average song duration, of the album that has most songs

            // Bonus:
            // - print the longest song duration of the album that has least songs
            // - print the name of the album that has most songs that contain letter 'a' in the name
            // - print the name of the artist that has most songs that end with letter 'd'



            // ************ Don't mind the structure, focus on the lists declared on the beginning of Program.cs ****************

            // 3, 2, 1.... GO! :)



            // - how many Songs start with the letter 'a' (case insensitive)
            int songsStartsWithA = Songs.Select(x => x.Name.ToLower())
                                   .Where(x => x.StartsWith("a"))
                                   .ToList()
                                   .Count();

            Console.WriteLine(songsStartsWithA);

            // - how many artists end with letter 'a' (case insensitive)
            int artistEndWithA = Artists.Select(x => x.FullName.ToLower())
                                 .Where(x => x.EndsWith("a"))
                                 .ToList()
                                 .Count();

            Console.WriteLine(artistEndWithA);

            // - whats the name of the song with longest duration
            Song longestSong = Songs.FirstOrDefault(x => x.Duration == Songs
                                                    .Select(y => y.Duration)
                                                    .Max());

            Console.WriteLine(longestSong.Name);

            // - whats the total Duration of all Songs
            int totalDurationSongs = Songs.Select(x => x.Duration)
                                     .Sum();

            Console.WriteLine(totalDurationSongs);

            // - how many albums have Songs longer than 300 second
            int longerThan300 = Songs.Where(x => x.Duration > 300)
                                .GroupBy(x => x.AlbumId)
                                .ToList()
                                .Count();

            Console.WriteLine(longerThan300);

            // - print the names of the artists(separated with "--"), that have more than one album of PopRock genre

            var PopRockgenre = Artists.Where(x => x.Albums
                                             .Where(y => y.Genre == Genre.PopRock).ToList().Count() > 1)
                               .Select(v => v.FullName)
                               .ToList();

            PopRockgenre.ForEach(q => Console.Write($"{q} -- "));

            //foreach (var item in Artists)
            //{
            //    int popRockAlbums = item.Albums.Where(x => x.Genre == Genre.PopRock).ToList().Count();
            //    if (popRockAlbums > 1)
            //    {
            //        Console.Write($"{item.FullName} -- ");
            //    }
            //}

            // - print the name of the album that has highest Average duration of a song
            Album highestAverageDuration = Albums.OrderBy
                                               (x => x.Songs.Select(y => y.Duration)
                                               .Average())
                                           .ToList()
                                           .LastOrDefault();

            Console.WriteLine();
            Console.WriteLine(highestAverageDuration.Name);


            // - how many characters has the song that has the shortest Duration
            Song manyCharactersShortest = Songs
                                          .OrderByDescending(x => x.Duration)
                                          .ToList()
                                          .LastOrDefault();

            Console.WriteLine(manyCharactersShortest.Name.Count());

            // - print the name and the genre of the album that has most songs
            Album mostSongsAlbum = Albums
                                   .OrderBy(x => x.Songs.Count())
                                   .ToList()
                                   .LastOrDefault();

            Console.WriteLine($"{mostSongsAlbum.Name} {mostSongsAlbum.Genre}");

            // - print the name of the artist that has most songs
            string artistMostoSongs = Artists
                                      .OrderBy(x => x.Albums
                                               .Select(y => y.Songs)
                                               .Count()).Select(z => z.FullName).LastOrDefault();

            Console.WriteLine(artistMostoSongs);

            // - print the type of the artist(SoloArtist/Band) that has most albums published before year 2000
            Genre mostAlbumsBefore2000 = Albums
                                         .Where(x => x.Year < 2000)
                                         .Select(y => y.Genre)
                                         .Max();

            Console.WriteLine(mostAlbumsBefore2000);

            // - print the average song duration, of the album that has most songs
            double AverageSongDurationMax = Albums.Where(x => x.Songs.Count() == Albums
                                                         .Select(y => y.Songs.Count()).Max())
                                            .FirstOrDefault().Songs
                                            .Select(z => z.Duration)
                                            .Average();

            Console.WriteLine(AverageSongDurationMax);


            // Bonus:
            // - print the longest song duration of the album that has least songs
            int LongestSongDuration = Albums.Where(x => x.Songs.Count() == Albums
                                                   .Select(y => y.Songs.Count()).Min())
                                      .FirstOrDefault().Songs
                                      .Select(z => z.Duration)
                                      .Max();

            Console.WriteLine(LongestSongDuration);

            // - print the name of the album that has most songs that contain letter 'a' in the name
            string nameOfTheAlbumWithA = Albums.Where(x => x.Songs
                                                      .Where(y => y.Name.ToLower().Contains('a')).Count() == Albums
                                                      .Select(z => z.Songs
                                                              .Where(q => q.Name.ToLower().Contains('a')).Count())
                                                      .Max()).Select(u => u.Name)
                                         .FirstOrDefault();

            Console.WriteLine(nameOfTheAlbumWithA);

            // - print the name of the artist that has most songs that end with letter 'd'
            string nameOfTheArtistD = Artists.Where(x => x.Albums
                                                    .Select(y => y.Songs
                                                            .Where(z => z.Name.ToLower().EndsWith('d')).Count()).Sum() == Artists
                                                    .Select(q => q.Albums
                                                            .Select(w => w.Songs
                                                                    .Where(e => e.Name.ToLower().EndsWith('d')).Count()).Sum()).Max()).Select(r => r.FullName)
                                      .FirstOrDefault();

            Console.WriteLine(nameOfTheArtistD);


            Console.ReadLine();
        }
Exemple #7
0
 public override string ToString()
 {
     return($"{Name} by {String.Join(", ", Artists.Select(that => that.Name))}");
 }
Exemple #8
0
 public override string ToString()
 {
     return(string.Format("{0} - {1}", String.Join(", ", Artists.Select(artist => artist.Name)), Name));
 }
Exemple #9
0
        static void Main(string[] args)
        {
            Action line = () => Console.WriteLine("-----------------------------------------------------------");

            Init();

            //1 - how many Songs start with the letter 'a' (case insensitive)
            int counter          = 0;
            var songsWithLetterA = Songs.Select(x => x.Name.ToLower()).Where(x => x.StartsWith("a"));

            foreach (var item in songsWithLetterA)
            {
                counter++;
            }
            Console.WriteLine(counter + " songs start with letter 'a'");
            line();

            //2 - how many artists end with letter 'a' (case insensitive)
            int counter2             = 0;
            var songsEndsWithLetterA = Songs.Select(x => x.Name.ToLower()).Where(x => x.EndsWith("a"));

            foreach (var item in songsEndsWithLetterA)
            {
                counter2++;
            }
            Console.WriteLine(counter2 + " song ends with letter 'a'");
            line();

            //3 - whats the name of the song with longest duration
            var songsDuration           = Songs.Select(x => x.Duration);
            var longest                 = songsDuration.Max();
            var songWithLongestDuration = Songs.Where(x => x.Duration == longest);

            foreach (var item in songWithLongestDuration)
            {
                Console.WriteLine("Song with longest duration is: " + item.Name);
            }
            line();

            //4 - whats the total Duration of all Songs
            var totalDuration = songsDuration.Sum();

            Console.WriteLine("Total Duration of all Songs is : " + totalDuration);
            line();

            //5 - how many albums have Songs longer than 300 seconds
            var durationOfSongsLongerThan300 = Songs.Where(x => x.Duration >= 300);
            var albumsOfTheSongs             = durationOfSongsLongerThan300.Select(x => x.AlbumId).Distinct().Count();

            Console.WriteLine("There are " + string.Join(" ", albumsOfTheSongs) + " albums that have songs longer than 300 seconds");
            line();

            //6 - print the names of the artists(separated with "--"), that have more than one album of PopRock genre
            List <string> newList     = new List <string>();
            var           albumsGenre = Albums.Where(x => x.Genre == Genre.PopRock);

            foreach (var item in albumsGenre)
            {
                var artistPopRock = Artists.Where(x => x.Id == item.ArtistId);
                foreach (var item2 in artistPopRock)
                {
                    newList.Add(item2.FullName);
                }
            }
            Console.WriteLine("Artist that have more than one album of PopRock genre are :");
            var something0 = newList.GroupBy(x => x).Where((g => g.Count() > 1));

            foreach (var item in something0)
            {
                Console.WriteLine("--" + item.Key);
            }
            line();

            //7 - print the name of the album that has highest Average duration of a song
            var highestDuration = Albums.Select(x => new { _album = x.Name, _duration = x.Songs.Average(d => d.Duration) })
                                  .OrderByDescending(x => x._duration).First();

            Console.WriteLine($"The album with highest average duration of a song is : {highestDuration._album}");

            line();
            //8 - how many characters has the song that has the shortest Duration
            var shortestSong = Songs.OrderBy(x => x.Duration).First();

            char [] charArray = shortestSong.Name.ToString().ToCharArray();
            double  count     = 0;

            foreach (var c in charArray)
            {
                count++;
            }
            Console.WriteLine("The song with shortest duration has " + count + " characters");
            line();

            //9 - print the name and the genre of the album that has most songs
            var findId          = Songs.GroupBy(p => p.AlbumId).OrderByDescending(r => r.Count()).FirstOrDefault();
            var nameOftheAlbum1 = Albums.Where(x => x.Id == findId.Key).FirstOrDefault();

            Console.WriteLine("The name of the album is : " + nameOftheAlbum1.Name + " of genre " + nameOftheAlbum1.Genre);
            line();

            //10 - print the name of the artist that has most songs
            var artistMostSongs = Artists
                                  .Select(x => new { NameOfArtist = x.FullName, SongsOfArtist = x.Albums.Sum(y => y.Songs.Count) })
                                  .OrderByDescending(a => a.SongsOfArtist)
                                  .First();

            Console.WriteLine($"Artist: {artistMostSongs.NameOfArtist}, Songs Count: {artistMostSongs.SongsOfArtist}");


            line();
            //11 - print the type of the artist(SoloArtist/Band) that has most albums published before year 2000
            var before2000 = Albums.Where(x => x.Year < 2000).First();
            var theArtist  = Artists.Where(x => x.Id == before2000.Id);

            foreach (var item in theArtist)
            {
                Console.WriteLine(item.FullName);
            }
            line();

            //12 - print the average song duration, of the album that has most songs
            var findAlbumId     = Songs.GroupBy(p => p.AlbumId).OrderByDescending(r => r.Count()).FirstOrDefault();
            var averageDuration = Songs.Where(p => p.AlbumId == findAlbumId.Key).Average(x => x.Duration);

            Console.WriteLine("The average duration of the album with the most songs is : " + averageDuration);
            line();

            // Bonus:
            Console.WriteLine("Bonus:");
            line();

            //13 - print the longest song duration of the album that has least songs
            var albumWithLeastSong  = Songs.GroupBy(q => q.AlbumId).OrderBy(gp => gp.Count()).FirstOrDefault();
            var shortestSonginAlbum = albumWithLeastSong.OrderByDescending(x => x.Duration).FirstOrDefault();

            Console.WriteLine("The longest song of the album with least songs is " + shortestSonginAlbum.Name +
                              " with duration " + shortestSonginAlbum.Duration);
            line();

            //14 - print the name of the album that has most songs that contain letter 'a' in the name
            var containA = Albums.Select(x => new { _album = x.Name, _containA = x.Songs.Where(y => y.Name.Contains("a")).Count() })
                           .OrderByDescending(x => x._containA).FirstOrDefault();

            Console.WriteLine($"The name of the album that has most songs that contain letter 'a' is {containA._album}");

            line();

            //15 - print the name of the artist that has most songs that end with letter 'd'


            line();
            Console.ReadLine();
        }
 public override string ToString()
 {
     return(Name + (Artists != null ? " - " + string.Join(", ", Artists.Select(_ => _.Name)) : ""));
 }
        static void Main(string[] args)
        {
            Init();// this method fills the arrays above with data

            // - print the mass of the earth on July 1895 XD

            /*
             *  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
             *  ░░░░░░░░░░░░░░░░░░░░░░████████░░░░░░░░░
             *  ░░███████░░░░░░░░░░███▒▒▒▒▒▒▒▒███░░░░░░
             *  ░░█▒▒▒▒▒▒█░░░░░░░███▒▒▒▒▒▒▒▒▒▒▒▒███░░░░
             *  ░░░█▒▒▒▒▒▒█░░░░██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██░░
             *  ░░░░█▒▒▒▒▒█░░░██▒▒▒▒▄██▄▒▒▒▒▄██▄▒▒▒███░
             *  ░░░░░█▒▒▒█░░░█▒▒▒▒▒▒████▒▒▒▒████▒▒▒▒▒██
             *  ░░░█████████████▒▒▒▒▀██▀▒▒▒▒▀██▀▒▒▒▒▒██
             *  ░░░█▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒▒▒▒▒██
             *  ░██▒▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒██▒▒▒▒▒▒▒▒▒██▒▒▒▒██
             *  ██▒▒▒███████████▒▒▒▒▒██▒▒▒▒▒▒▒██▒▒▒▒▒██
             *  █▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒███████▒▒▒▒▒▒▒██
             *  ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██░
             *  ░█▒▒▒███████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██░░░
             *  ░██▒▒▒▒▒▒▒▒▒▒▒███▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█░░░░░
             *  ░░████████████░░░████████████████░░░░░░
             *  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
             *  ░░▄█████▄░▄███████▄░▄███████▄░██████▄░░
             *  ░░██▒▒▒▒█░███▒▒▒███░███▒▒▒███░██▒▒▒██░░
             *  ░░██▒▒▒▒▒░██▒▒▒▒▒██░██▒▒▒▒▒██░██▒▒▒██░░
             *  ░░██▒▒▒▀█░███▒▒▒███░███▒▒▒███░██▒▒▒██░░
             *  ░░▀█████▀░▀███████▀░▀███████▀░██████▀░░
             *  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
             *  ░░░░██▒▒▒▒░██▒▒▒██░▄█████░██▒▒▒▒██▀░░░░
             *  ░░░░██▒▒▒▒░██▒▒▒██░██▀▒▒▒░██▒▒▒██░░░░░░
             *  ░░░░██▒▒▒▒░██▒▒▒██░██▒▒▒▒░█████▀░░░░░░░
             *  ░░░░██▒▒▒▒░██▄▒▄██░██▄▒▒▒░██▒▒▒██░░░░░░
             *  ░░░░▀█████░▀█████▀░▀█████░██▒▒▒▒██▄░░░░
             *  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
             */

            // QUERIES!

            // - how many Songs start with the letter 'a' (case insensitive)

            List <Song> songStartA = Songs
                                     .Where(song => song.Name.ToLower()
                                            .StartsWith("a"))
                                     .ToList();

            Console.WriteLine($"1) Number od songs that start with the letter 'a' is: {songStartA.Count}");
            Console.WriteLine("");

            // - how many artists end with letter 'a' (case insensitive)

            List <Artist> artistEndA = Artists
                                       .Where(artist => artist.FullName.ToLower()
                                              .EndsWith("a"))
                                       .ToList();

            Console.WriteLine($"2) Number of artist that end with letter 'a' is: {artistEndA.Count}");
            Console.WriteLine("");

            // - whats the name of the song with longest duration

            Song longestSong = Songs
                               .FirstOrDefault(song => song.Duration == Songs
                                               .Select(sg => sg.Duration)
                                               .Max());

            Console.WriteLine($"3) The name of the song with the largest duration is: {longestSong.Name}");
            Console.WriteLine("");

            // - whats the total Duration of all Songs

            int totalDuration = Songs
                                .Select(song => song.Duration)
                                .Sum();

            Console.WriteLine($"4) The total duration of all songs is: {totalDuration} seconds");
            Console.WriteLine("");

            // - how many albums have Songs longer than 300 seconds

            int longSongAlbums = Albums
                                 .Where(album => album.Songs
                                        .Any(song => song.Duration > 300))
                                 .Count();

            Console.WriteLine($"5) Number of albums that have Songs longer than 300 seconds is {longSongAlbums}");
            Console.WriteLine("");

            // - print the names of the artists(separated with "--"), that have more than one album of PopRock genre

            List <string> popRockArtists = Artists
                                           .Where(artist => artist.Albums
                                                  .Any(album => album.Genre == Genre.PopRock))
                                           .Where(x => x.Albums.Count() > 1)
                                           .Select(name => name.FullName)
                                           .ToList();

            Console.WriteLine("6) Names of artists with more than one PopRock album:");
            popRockArtists.ForEach(artist => Console.Write($"{artist} -- "));
            Console.WriteLine("");
            Console.WriteLine("");


            // - print the name of the album that has highest Average duration of a song

            Album albumHigestAverage = Albums
                                       .FirstOrDefault(album => album.Songs
                                                       .Select(song => song.Duration).Average() == Albums
                                                       .Select(alb => alb.Songs
                                                               .Select(sg => sg.Duration).Average())
                                                       .Max());

            Console.WriteLine($"7) Name of the album that has highest Average duration of a song is: {albumHigestAverage.Name}");
            Console.WriteLine("");

            // - how many characters has the song that has the shortest Duration


            Song shortSongChar = Songs
                                 .FirstOrDefault(song => song.Duration == Songs
                                                 .Select(sg => sg.Duration)
                                                 .Min());

            Console.WriteLine($"8) The song that has the shortest Duration is called '{shortSongChar.Name}' and has {shortSongChar.Name.Count()} characters");
            Console.WriteLine("");

            // - print the name and the genre of the album that has most songs

            Album mostSongsAlbun = Albums
                                   .FirstOrDefault(album => album.Songs.Count == Albums
                                                   .Select(alb => alb.Songs.Count)
                                                   .Max());

            Console.WriteLine($"9) Name of album that has most songs {mostSongsAlbun.Name} - Genre: {mostSongsAlbun.Genre}");
            Console.WriteLine("");

            // - print the name of the artist that has most songs

            Artist mostSongsArtist = Artists
                                     .FirstOrDefault(artist => artist.Albums
                                                     .Select(album => album.Songs.Count).Sum() == Artists
                                                     .Select(ar => ar.Albums
                                                             .Select(al => al.Songs.Count).Sum())
                                                     .Max());

            Console.WriteLine($"10) Name of artist with most songs: {mostSongsArtist.FullName}");
            Console.WriteLine("");

            // - print the type of the artist(SoloArtist/Band) that has most albums published before year 2000

            Artist mostOldAlbums = Artists
                                   .FirstOrDefault(artist => artist.Albums.Count(alb => alb.Year < 2000) == Artists
                                                   .Select(ar => ar.Albums.Count(al => al.Year < 2000))
                                                   .Max());

            Console.WriteLine($"11) Type of the artist(SoloArtist/Band) that has most albums published before year 2000: {mostOldAlbums.ArtistType}");
            Console.WriteLine($"Name of artist(SoloArtist/Band): {mostOldAlbums.FullName}");
            Console.WriteLine("");

            // - print the average song duration, of the album that has most songs

            double mostSongAlbAverDur = Albums
                                        .FirstOrDefault(album => album.Songs.Count == Albums
                                                        .Select(alb => alb.Songs.Count).Max())
                                        .Songs
                                        .Select(song => song.Duration)
                                        .Average();

            Console.WriteLine($"12) Average song duration, of the album that has most songs: {mostSongAlbAverDur}");
            Console.WriteLine("");

            // Bonus:
            // - print the longest song duration of the album that has least songs

            Song longSongShortAlbum = Albums
                                      .FirstOrDefault(album => album.Songs.Count == Albums.Select(alb => alb.Songs.Count).Min())
                                      .Songs.FirstOrDefault(song => song.Duration == Albums
                                                            .Where(al => al.Songs.Count() == Albums
                                                                   .Select(x => x.Songs.Count())
                                                                   .Min())
                                                            .FirstOrDefault().Songs.Select(sg => sg.Duration).Max());


            Console.WriteLine($"13) The longest song duration of the album that has least songs is {longSongShortAlbum.Duration}");
            Console.WriteLine($"The name of the song is: '{longSongShortAlbum.Name}'");
            Console.WriteLine("");

            // - print the name of the album that has most songs that contain letter 'a' in the name

            Album albumSongsMostA = Albums
                                    .FirstOrDefault(album => album.Songs
                                                    .Where(song => song.Name.ToLower().Contains('a')).Count() == Albums
                                                    .Select(alb => alb.Songs
                                                            .Where(sg => sg.Name.ToLower().Contains('a')).Count())
                                                    .Max());

            Console.WriteLine($"14) Name of the album that has most songs that contain letter 'a' in the name is '{albumSongsMostA.Name}'");
            Console.WriteLine("");


            // - print the name of the artist that has most songs that end with letter 'd'

            Artist artistSongsEndsD = Artists
                                      .FirstOrDefault(artist => artist.Albums
                                                      .Select(album => album.Songs
                                                              .Where(song => song.Name.ToLower().EndsWith('d')).Count()).Sum() == Artists
                                                      .Select(art => art.Albums
                                                              .Select(alb => alb.Songs
                                                                      .Where(sg => sg.Name.ToLower().EndsWith('d')).Count()).Sum())
                                                      .Max());

            Console.WriteLine($"15) Name of the artist that has most songs that end with letter 'd' is '{artistSongsEndsD.FullName}'");

            // ************ Don't mind the structure, focus on the lists declared on the beginning of Program.cs ****************

            // 3, 2, 1.... GO! :)



            Console.ReadLine();
        }