Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var post = new Post
            {
                Title       = "Post title",
                Description = "Body of post..."
            };

            post.UpVote();
            post.UpVote();
            post.UpVote();
            post.UpVote();

            post.DownVote();
            post.DownVote();

            post.PostInfo();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            //Console.WriteLine("Hello World!");
            var post = new Post("The Title", "The Description");

            post.UpVote();
            post.UpVote();
            post.DownVote();
            post.UpVote();
            post.Show();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            var post = new Post("First post", "Description of the post");

            post.UpVote();
            post.UpVote();
            post.UpVote();

            post.DownVote();

            Console.WriteLine("Title: " + post.Title);
            Console.WriteLine("Description: " + post.Description);
            Console.WriteLine("Date: " + post.Date);
            Console.WriteLine("Rating: " + post.Rating);

            Console.Read();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            int  choice;
            Post p1 = new Post("What is Object", "Object is instance of class", DateTime.Now);

            Console.WriteLine("Hello World!");
            Console.WriteLine("1.Up Vote");
            Console.WriteLine("2.Down Vote");
            Console.WriteLine("3.Display Vote Count");
            Console.WriteLine("4.Exit");
            Console.WriteLine("Enter choice:");
            do
            {
                choice = Convert.ToInt32(Console.ReadLine());
                switch (choice)
                {
                case 1:
                    p1.UpVote();
                    break;

                case 2:
                    p1.DownVote();
                    break;

                case 3:
                    Console.WriteLine("Vote Count:" + p1.voteCount);
                    break;

                case 4:
                    System.Environment.Exit(0);
                    break;

                default:
                    Console.WriteLine("Invalid Choice... Please try again");
                    break;
                }
            } while (true);
        }