Example #1
0
        static void DZ3()
        {
            // Assume that the number of rows in the text file is always at least 10.
            // Assume a valid input file.
            string fileName       = "shows.tv";
            string outputFileName = "storage.tv";

            IPrinter printer = new ConsolePrinter();

            printer.Print($"Reading data from file {fileName}");

            Episode[] episodes = TvUtilities.LoadEpisodesFromFile(fileName);

            Season season = new Season(1, episodes);


            printer.Print(season.ToString());
            for (int i = 0; i < season.Length; i++)
            {
                season[i].AddView(TvUtilities.GenerateRandomScore());
            }
            printer.Print(season.ToString());

            printer = new FilePrinter(outputFileName);
            printer.Print(season.ToString());
        }
Example #2
0
        static void DZ1()
        {
            Episode ep1, ep2;

            ep1 = new Episode();
            ep2 = new Episode(10, 64.39, 8.7);
            int viewers = 10;

            for (int i = 0; i < viewers; i++)
            {
                ep1.AddView(TvUtilities.GenerateRandomScore());
                Console.WriteLine(ep1.GetMaxScore());
            }
            if (ep1.GetAverageScore() > ep2.GetAverageScore())
            {
                Console.WriteLine($"Viewers: {ep1.GetViewerCount()}");
            }
            else
            {
                Console.WriteLine($"Viewers: {ep2.GetViewerCount()}");
            }
        }