Esempio n. 1
0
 public void PrintStatisticCountry(Country?country1, Country?country2, CalculateStatistics statistics, string statistic, List <Country>?countries)
 {
     if (statistic == "population")
     {
         Console.WriteLine(PopulationCountry(country1));
     }
     else if (statistic == "area")
     {
         Console.WriteLine(AreaCountry(country1));
     }
     else if (statistic == "capital")
     {
         Console.WriteLine(CapitalCountry(country1));
     }
     else if (statistic == "density")
     {
         Console.WriteLine(DensityCountries(country1, country2, statistics));
     }
     else if (statistic == "average")
     {
         Console.WriteLine(AverageCountries(statistics, countries));
     }
     else
     {
         Console.WriteLine("Statistics not supported ");
     }
 }
Esempio n. 2
0
 public string AverageCountries(CalculateStatistics statistics, List <Country>?countries)
 {
     if (countries is null)
     {
         return("Invalid countries");
     }
     return("The average population of all countries is " + statistics.AvgPopulationCountries(countries).ToString());
 }
Esempio n. 3
0
File: Program.cs Progetto: mp11b/PRZ
        public static void Main()
        {
            RESTCountries       apiCountries        = new RESTCountries();
            CalculateStatistics calculateStatistics = new CalculateStatistics();
            PrintCountriesInfo  printCountries      = new PrintCountriesInfo();
            ConsoleUI           consoleUI           = new ConsoleUI(apiCountries, calculateStatistics, printCountries);

            consoleUI.UI();
        }
Esempio n. 4
0
        public string DensityCountries(Country?country1, Country?country2, CalculateStatistics statistics)
        {
            if (country1 is null || country2 is null)
            {
                return("This country1 or country2 does not exist. Try again");
            }

            return("The country with the highest density is " + statistics.CompareCountries(country1, country2).ToString());
        }
Esempio n. 5
0
 public void PrintTotalPopulation(List <Country> countries, CalculateStatistics statistics)
 {
     Console.WriteLine("Total Population: {0}", statistics.TotalPopulation(countries));
 }
Esempio n. 6
0
 public ConsoleUI(RESTCountries apiCountries, CalculateStatistics statistics, PrintCountriesInfo printCountries)
 {
     this.apiCountries   = apiCountries;
     this.statistics     = statistics;
     this.printCountries = printCountries;
 }