コード例 #1
0
        static void Main(string[] args)
        {
            Poster    poster    = new Poster("Eva", 500);
            Guest     guest     = new Guest("Anna", 430);
            Moderator moderator = new Moderator("moderator123");

            poster.PostComment("comment 01");
            poster.PostComment("comment 02");
            poster.PostComment("comment 03");
            poster.PostComment("comment 04");

            poster.PrintUser();
            poster.CheckStats();
            Console.WriteLine("------------------------------------------------------------");

            guest.PrintUser();
            guest.ReadComment("some comment...");
            Console.WriteLine("------------------------------------------------------------");

            moderator.PrintUser();
            moderator.BanUser(poster, "offensive comments");


            Console.ReadLine();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Guest guestOne = new Guest("Guest1", new List <string> {
                "Excellent", "Awful", "Horrible"
            }, 25);
            Guest guestTwo = new Guest("Guest2", new List <string> {
                "Excellent", "Great", "Amazing"
            }, 26);

            guestOne.PrintUser();
            guestTwo.PrintUser();

            Console.WriteLine("========");

            guestOne.ReadComment("Everything is great!");
            guestTwo.ReadComment("Everything is horrible!");


            Console.WriteLine("------");

            Poster posterOne = new Poster("posterOne12", new List <string> {
                "Bad", "Not good", "Okay"
            }, 100, false);
            Poster posterTwo = new Poster("posterOne122", new List <string> {
                "Excellent", "Great", "Good", "Amazing"
            }, 200, true);

            posterOne.CheckStats();
            posterTwo.CheckStats();

            Console.WriteLine("========");

            posterOne.PrintUser();
            posterTwo.PrintUser();

            Console.WriteLine("------");

            Moderator moderatorOne = new Moderator("moderator1234", new List <string> {
                "Comment one", "Comment two", "Comment three"
            }, new List <string> {
                "User123", "User256", "User198"
            });
            Moderator moderatorTwo = new Moderator("moderator987", new List <string> {
                "Comment one", "Comment two"
            }, new List <string> {
                "User123", "User256", "User198", "User45"
            });

            moderatorOne.PrintUser();
            moderatorTwo.PrintUser();

            Console.WriteLine("========");

            moderatorOne.BanUser("Some reason");
            moderatorTwo.BanUser("More reasons");

            Console.ReadLine();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            Poster    bob       = new Poster("BobBobski");
            Moderator jill      = new Moderator("JillJill");
            Guest     someGuest = new Guest();

            bob.PostComment("comment 1");
            bob.PostComment("comment 2");
            bob.CheckStats();
            jill.BanUser(bob, "bad bob");
            someGuest.ReadComment("comment some comment");
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: kristinaiv992/CsharpTasks
        static void Main(string[] args)
        {
            //Exercise:

            /*Create a user class that has:
             * Username
             * Role - Guest, Moderator, Poster
             * Comments - list of strings
             * PostComment(method ) - accepts a comment and adds it to the Comments list
             * PrintUser( abstract method ) - prints all details of a user
             * Note : You can't create a user object
             *
             * Create a class Poster that has:
             * Points
             * IsPosterOfTheWeek
             * CheckStats(method ) - prints a message how many points and comments this user has
             * Has default Role of Poster
             *
             * Create a Guest class that has:
             * Id
             * ReadComment(method ) - accepts string and writes in the console: The Guest with Id: Id read this comment: Comment
             * If guest tries to post, it should show a message: Guests cannot post
             * Has default Role of Guest
             * Create Moderator class that has:
             *
             * Users - list of users
             * BanUser(Method ) - accepts a user and a string REASON and writes in the console: The user Username is banned for REASON
             * Has default Role of Moderator */

            //List<User> Users = new List<User>();
            var   Users    = new List <User>();
            var   comento  = new List <string>();
            Guest Kristina = new Guest();

            Kristina.UserName = "******";
            Kristina.Id       = 3;
            Kristina.PostComments("lelele");
            Kristina.ReadComments("helloy guys anyone knows JavaScript?");
            //-------------------------------------------------
            Guest Martina = new Guest();

            Martina.UserName = "******";
            Martina.Id       = 31;
            Martina.PostComments("lelele");
            Martina.ReadComments("helloy guys anyone knows CSS && c#?");
            //------------------------------------------------
            Moderator Stevo = new Moderator();

            Stevo.UserName = "******";
            List <string> Comments = new List <string>();

            Stevo.PostComments("Don't be rude!");
            Stevo.PostComments("Guys please be careful while you communicate between!");
            Stevo.BanUser("kika9909", "being clumsy");
            //-------------------------------------------------
            Poster Venko = new Poster(22, false);

            Venko.UserName = "******";
            Venko.CheckStats();
            Poster Marko = new Poster(10, true);

            Marko.UserName = "******";
            Marko.CheckStats();
            Marko.PrintUser();

            foreach (var item in Users)
            {
                Console.WriteLine(item);
            }
        }