public static void CompareArtists(BackEndService service) { Console.WriteLine("Enter First Artists name:"); string artist1 = Console.ReadLine(); Console.WriteLine("Enter Second Artists name:"); string artist2 = Console.ReadLine(); double artist1Average = service.GetAverageLyricCount(artist1); if (double.IsNaN(artist1Average)) { artist1Average = 0; } double artist2Average = service.GetAverageLyricCount(artist2); if (double.IsNaN(artist2Average)) { artist2Average = 0; } double highest = Math.Max(artist1Average, artist2Average); double lowest = Math.Min(artist1Average, artist2Average); double difference = highest - lowest; Console.WriteLine($"{artist1} has an average lyric count of {artist1Average}"); Console.WriteLine($"{artist2} has an average lyric count of {artist2Average}"); Console.WriteLine($"With a difference of {difference} words."); }
public static void GetSingleArtist(BackEndService service) { Console.WriteLine("Enter Artist name:"); string artist = Console.ReadLine(); Console.WriteLine("Average lyrics length:"); double average = service.GetAverageLyricCount(artist); if (double.IsNaN(average)) { Console.WriteLine("No lyrics found for artist"); } else { Console.WriteLine(average); } }