Beispiel #1
0
        public static void Main(string[] args)
        {
            MagazineCollection magazineCollection = new MagazineCollection();

            magazineCollection.AddMagazines(
                TestCollections.GetMegazine(4),
                TestCollections.GetMegazine(3),
                TestCollections.GetMegazine(5),
                TestCollections.GetMegazine(1),
                TestCollections.GetMegazine(2)
                );

            Console.WriteLine("MagazineCollection default: \n {0}\n", string.Join(" ; ", magazineCollection.Magazines.Select(x => x.EditionName).ToArray()));

            magazineCollection.SortByName();
            Console.WriteLine("Sorted by Name: \n {0}\n", string.Join(" ; ", magazineCollection.Magazines.Select(x => x.EditionName).ToArray()));

            magazineCollection.SortByDate();
            Console.WriteLine("Sorted by Date: \n {0}\n", string.Join(" ; ", magazineCollection.Magazines.Select(x => x.EditionName).ToArray()));

            magazineCollection.SortByCirculation();

            Console.WriteLine("Sorted by Circulation: \n {0}\n", string.Join(" ; ", magazineCollection.Magazines.Select(x => x.EditionName).ToArray()));

            Console.WriteLine("Maximum middle rate: {0}\n", magazineCollection.GetMaxMiddleRate());

            Console.WriteLine("Magazines with Frequency = Monthly:\n {0}\n",
                              string.Join(" ; ", magazineCollection.GetMontlyMagazines().Select(x => x.MagazineName).ToArray()));

            double value = 4;

            Console.WriteLine("Student with middle score more than {0}:\n {1}\n", value,
                              string.Join(" ; ", magazineCollection.GetRatingGroup(value).Select(x => x.MagazineName).ToArray()));

            TestCollections test = new TestCollections(10);

            Console.WriteLine("Searching time:");
            test.MeasureTime();
            Console.ReadKey();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Magazine magazine = new Magazine("Daily Buglees", Frequency.Monthly, new DateTime(2010, 12, 12), 250000);

            magazine.AddArticles(new Article(new Person("Nick", "Back", new DateTime(1990, 10, 20)),
                                             "Corona-Time", 2.2));
            magazine.AddEditors(new Person("Kek", "lol", new DateTime(1988, 8, 7)));

            MagazineCollection collection = new MagazineCollection();

            collection.AddDefaults();
            collection.AddMagazines(magazine);
            Console.WriteLine(collection.ToString());

            Console.WriteLine("Sorted by mane: ");
            collection.SortByName();
            Console.WriteLine(collection.ToString());

            Console.WriteLine("Sorted by releaseDate:");
            collection.SortByDate();
            Console.WriteLine(collection.ToString());

            Console.WriteLine("Sorted by copiesCount:");
            collection.SortByDate();
            Console.WriteLine(collection.ToString());

            Console.WriteLine($"Max avg rate: {collection.MaxAvgRate}");
            Console.WriteLine("Magazines with monthly frequency: ");
            Console.WriteLine(String.Join(",", collection.MonthlyMagazines.Select(magazineGroup => magazineGroup.ToString()).ToArray()));

            Console.WriteLine(collection.RatingGroup(2));

            TestCollection testCollection = new TestCollection(2000);

            testCollection.MeasureTime();
        }