コード例 #1
0
        static void Main(string[] args)
        {
            Accauntant accaunt    = new Accauntant();
            bool       TomBonus   = accaunt.AskForBonus(Post.handyman, 55);
            bool       BorisBonus = accaunt.AskForBonus(Post.manager, 42);

            Console.WriteLine($"Bonus for Tom? {TomBonus}");
            Console.WriteLine($"Bonus for Boris? {BorisBonus}");

            Console.ReadLine();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Post ourchief = Post.chief;

            if (Accauntant.AskForBonus(ourchief, 80))
            {
                Console.WriteLine(ourchief + " должен получать премию.");
            }
            else
            {
                Console.WriteLine(ourchief + " не должен получать премию.");
            }

            Post ourjanitor = Post.janitor;

            if (Accauntant.AskForBonus(ourjanitor, 100))
            {
                Console.WriteLine(ourjanitor + " должен получать премию.");
            }
            else
            {
                Console.WriteLine(ourjanitor + " не должен получать премию.");
            }

            Console.ReadKey();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: vnarozhnyi/ITVDN
        static void Main(string[] args)
        {
            DateTime now = DateTime.Now;
            DateTime birthday;
            TimeSpan wait;

            Console.WriteLine("Enter your date of birth in the format 'yyyy, mm, dd'");
            birthday = Convert.ToDateTime(Console.ReadLine());


            DateTime thisYear = new DateTime(now.Year, birthday.Month, birthday.Day);

            if (thisYear < now)
            {
                thisYear = new DateTime(now.Year + 1, birthday.Month, birthday.Day);
                wait     = thisYear - now;
            }
            else
            {
                wait = thisYear - now;
            }

            Console.WriteLine("Birthday left {0} days", wait.Days);


            Console.WriteLine(new string('-', 50));


            Console.WriteLine("Enter the string:");
            string line = Console.ReadLine();

            Console.WriteLine("Specify color: ( 0-blue, 2-green, 1-red)");
            int color = Convert.ToInt32(Console.ReadLine());

            MyClass.Print(line, color);


            Console.WriteLine(new string('-', 50));


            Console.Write("Enter the number of hours worked: ");
            int hours = Convert.ToInt32(Console.ReadLine());

            Accauntant a = new Accauntant();

            if (a.AskForBonus(Post.Cleaner, hours))
            {
                Console.WriteLine("Give a bonus");
            }
            else
            {
                Console.WriteLine("Do not give out a bonus");
            }

            Console.ReadKey();
        }