コード例 #1
0
        // Main method to use to add the student
        public void AddStudents()
        {
            bool finish = false;

            while (!finish)
            {
                Console.WriteLine("\t\t You can add Student details and Grade Here\n\t\t Please " +
                                  "follow the instructions");
                Console.WriteLine("\t\tPlease Enter Student Id");
                int id = Convert.ToInt32(ConsolHelper.GetInput());
                Console.WriteLine("\t\tPlease Enter Students's Full Name");
                string name = Console.ReadLine();
                Console.WriteLine("\t\t Please Enter The Final Mark of the Student");
                int     mark    = ConsolHelper.GetInput1();
                Student student = new Student(id, name, mark);
                AddObject(student);

                Console.WriteLine(student);

                Console.WriteLine("Please enter yes for main menu or press any key to exit");
                // continue or finish the program
                string lastcommand = Console.ReadLine().ToLower();
                if (lastcommand == "yes")
                {
                    finish = true;
                    MainMenu();
                }
                else
                {
                    break;
                }
            }
        }
コード例 #2
0
        // Add the comments to the particular post
        private void AddComment()
        {
            Console.WriteLine("Please enter the id of the post you would like to comment");
            int id = ConsolHelper.GetInput1();

            if (newsFeed.FindMessageById(id) != null)
            {
                Console.WriteLine("Please write the comment");
                string comment = Console.ReadLine();
                newsFeed.Addcomment(comment, id);
                DisplayMenu();
            }
            else if (newsFeed.FindPhotoById(id) != null)
            {
                Console.WriteLine("Please write the comment");
                string comment = Console.ReadLine();
                newsFeed.Addcomment(comment, id);
                DisplayMenu();
            }
            else
            {
                Console.WriteLine("\tPlease enter Valid ID");
                DisplayMenu();
            }
        }
コード例 #3
0
        private void UnLikePost()
        {
            Console.WriteLine("\t Pleae enter the Id You like to like");
            int id = ConsolHelper.GetInput1();

            newsFeed.UnLikePost(id);
            DisplayMenu();
        }
コード例 #4
0
        public void DisplayMenu()
        {
            ConsolHelper.PrintHeader(options);
            Console.WriteLine("Please choose from One of the Options above");
            int choice = ConsolHelper.GetInput1();

            if (choice > 0 && choice < options.Length + 1)
            {
                Choice(choice);
            }
            else
            {
                Console.WriteLine("\t Please Enter from the options Above");
                DisplayMenu();
            }
        }
コード例 #5
0
        public void MainMenu()
        {
            Console.WriteLine("\t\t This is Student Grading console application" +
                              "\n\t\t\t By: Yamin Hassan" +
                              "\n\t\t Please enter from one of the choices below " +
                              "\n\t\t 1: Add Student\n \t\t 2: PrintAll\n\t\t 3: Mean Maximum and Minimum Mark" +
                              "\n\t\t 4: Grade Profile ");
            int choice = ConsolHelper.GetInput1();

            if (choice >= 1 && choice <= list.Length)
            {
                Choice(choice);
            }
            else
            {
                Console.WriteLine("Please Enter from Choices below ");
                MainMenu();
            }
        }
コード例 #6
0
        // Remove post method lead to two choices of post message and photo post.
        private void RemovePost()
        {
            Console.WriteLine("Please select ID of the post you would like to remove");
            int id = ConsolHelper.GetInput1();

            if (newsFeed.FindMessageById(id) != null)
            {
                newsFeed.RemovePost(id);
                Console.WriteLine($"The ID: {id} is removed from data base");
                DisplayMenu();
            }
            else if (newsFeed.FindPhotoById(id) != null)
            {
                newsFeed.RemovePost(id);
                Console.WriteLine($"The ID: {id} is removed from data base");
                DisplayMenu();
            }
            else
            {
                Console.WriteLine("\t Please enter valid id");
                DisplayMenu();
            }
        }