コード例 #1
0
        static void Main(string[] args)
        {
            double GenerateRandomScore()
            {
                double score;
                Random rand = new Random();

                score = rand.NextDouble() * 10;
                score = Math.Round(score, 1);
                return(score);
            }

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

            for (int i = 0; i < viewers; i++)
            {
                ep1.AddView(GenerateRandomScore());
                Console.WriteLine(ep1.GetMaxScore());
            }
            if (ep1.GetAverageScore() > ep2.GetAverageScore())
            {
                Console.WriteLine($"Viewers: {ep1.GetViewerCount()}");
            }
            else
            {
                Console.WriteLine($"Viewers: {ep2.GetViewerCount()}");
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: drazen-b/OOP_Zadaca_CS
        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()}");
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: Tomislav0/oop-zadace
        static void Main(string[] args)
        {
            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(GetRandomScore());
                Console.WriteLine(ep1.GetMaxScore());
            }
            if (ep1.GetAverageScore() > ep2.GetAverageScore())
            {
                Console.WriteLine($"Viewers: {ep1.GetViewerCount()}");
            }
            else
            {
                Console.WriteLine($"Viewers: {ep2.GetViewerCount()}");
            }
        }