static void Main()
        {
            Snowman snowman = new Snowman("Aadu", 10);
            Random  rnd     = new Random();

            for (int i = 0; i < 3; i++)
            {
                int temp = rnd.Next(-5, 10);

                if (temp >= 0)
                {
                    snowman.SnowmanDeath();
                    WriteLine($"Snowman {snowman.Name} melts. It is one step closer to Aquaman. Its mass is now {snowman.Mass}");
                }

                else if (temp < 0)
                {
                    WriteLine("Snowmen do not melt below zero");
                }
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            //Lumememmme loomine
            Snowman snowman = new Snowman("Olaf");

            Console.WriteLine($"Hello, I'm {snowman.Name}");
            Random rnd = new Random();

            //3 päeva õues seismist

            for (int i = 0; i < 3; i++)
            {
                int temperature = rnd.Next(-5, 11);
                Console.WriteLine($"It is {temperature} degree today");
                snowman.Melt(temperature);
            }

            Console.WriteLine($"Mass of the snowman after three days: {snowman.Mass}");


            Console.ReadLine();
        }