diff --git a/.idea/.idea.EM-Qual/.idea/.gitignore b/.idea/.idea.EM-Qual/.idea/.gitignore
new file mode 100644
index 0000000..c1da699
--- /dev/null
+++ b/.idea/.idea.EM-Qual/.idea/.gitignore
@@ -0,0 +1,13 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Rider ignored files
+/projectSettingsUpdater.xml
+/modules.xml
+/contentModel.xml
+/.idea.EM-Qual.iml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/.idea.EM-Qual/.idea/vcs.xml b/.idea/.idea.EM-Qual/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/.idea.EM-Qual/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/EM-Qual/QualData.cs b/EM-Qual/QualData.cs
index e0596ad..ca19900 100644
--- a/EM-Qual/QualData.cs
+++ b/EM-Qual/QualData.cs
@@ -52,7 +52,14 @@ public static class QualData
/// True if the value is found; false otherwise
public static bool IsContained(string value, string[] possibleValues)
{
- // TODO
+ foreach (var possibleValue in possibleValues)
+ {
+ if (possibleValue.ToLower() == value.ToLower())
+ {
+ return true;
+ }
+ }
+
return false;
}
@@ -77,8 +84,17 @@ public static class QualData
/// Array of matches in which the supplied country participated
public static Match[] FilterMatchesByCountry(Match[] allMatches, string countryName)
{
- // TODO
- return [];
+ Match[] filteredMatches = [];
+ foreach (var match in allMatches)
+ {
+ if (IsCountryMatch(match, countryName))
+ {
+ filteredMatches = filteredMatches.Append(match).ToArray();
+ }
+
+ }
+
+ return filteredMatches;
}
///
@@ -89,8 +105,9 @@ public static class QualData
/// True if the country participated in the match; false otherwise
public static bool IsCountryMatch(Match match, string countryName)
{
- // TODO
- return false;
+ TeamResult homeTeam = match.HomeTeam;
+ TeamResult guestTeam = match.GuestTeam;
+ return homeTeam.TeamName == countryName || guestTeam.TeamName == countryName;
}
///
@@ -99,7 +116,12 @@ public static class QualData
/// Array of matches to print
private static void PrintMatches(Match[] matches)
{
- // TODO
+ foreach (var match in matches)
+ {
+ TeamResult homeTeam = match.HomeTeam;
+ TeamResult guestTeam = match.GuestTeam;
+ Console.WriteLine($"{homeTeam.TeamName} {homeTeam.Goals} - {guestTeam.Goals} {guestTeam.TeamName}");
+ }
}
///
@@ -111,7 +133,13 @@ public static class QualData
/// The name of the country the user selected
private static string AskForCountry(string[] possibleCountries)
{
- // TODO
- return string.Empty;
+ string country;
+ do
+ {
+ Console.Write("Enter country: ");
+ country = Console.ReadLine()!.ToLower();
+ } while (!IsContained(country!, possibleCountries));
+
+ return country;
}
}
\ No newline at end of file