示例#1
0
        /// <summary>
        /// The Choice method let the console user choose from matric and imperial units.
        /// </summary>

        public void Choice()
        {
            int unitChoice = ConsolHelper.SelectChoice("\t Body Mass Index\n\t\t By Yamin Hassan" +
                                                       "\n\tPlease use matric units to calculate your BMI", choices);

            ChooseUnits(Convert.ToInt32(unitChoice));
        }
        // 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;
                }
            }
        }
        // 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();
            }
        }
        private void UnLikePost()
        {
            Console.WriteLine("\t Pleae enter the Id You like to like");
            int id = ConsolHelper.GetInput1();

            newsFeed.UnLikePost(id);
            DisplayMenu();
        }
        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();
            }
        }
示例#6
0
        /// <summary>
        /// The PrintMatricResults calculate the Matric units and display the result.
        /// </summary>

        private void PrintMatricResults()
        {
            bool finish = false;

            while (!finish)
            {
                Console.WriteLine("\t Body Mass Index\n\t By Yamin Hassan");
                Console.WriteLine("\n\tPlease use matric units to calculate your BMI" +
                                  "\n\t Please  Enter your height in Metres >");

                HeightMetres = ConsolHelper.GetInput();

                Console.WriteLine("\tPlease  Enter your height in Centimetres >");
                HeightCentemetre = ConsolHelper.GetInput();

                Console.WriteLine($"\tWell you are {HeightMetres} Metres and {HeightCentemetre} Centimetres  tall");


                Console.WriteLine("\tPlease enter your weigt in Kilograms >");
                WeightKg = ConsolHelper.GetInput();

                Console.WriteLine("\tPlease enter your weigt in Grams >");
                WeightGrams = ConsolHelper.GetInput();

                Console.WriteLine($"\tThanks for your weight. You weight: {WeightKg}KG and {WeightGrams}");

                double Result = Math.Round((WeightKg + (WeightGrams / 1000)) / Math.Pow((HeightMetres +
                                                                                         (HeightCentemetre / 100)), 2), 1);
                Console.WriteLine(Result);
                ConsolHelper.BmiResult(Result);


                String lastcommand = Console.ReadLine().ToLower();

                if (lastcommand == "yes")
                {
                    finish = true;
                    Choice();
                }
                else
                {
                    finish = false;
                    break;
                }
            }
        }
        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();
            }
        }
示例#8
0
        /// <summary>
        /// The PrintMatricResults calculate the Imperial units and display the result.
        /// </summary>
        public void PrintImperialConversion()
        {
            bool finish = false;

            while (!finish)
            {
                Console.WriteLine("\t Body Mass Index\n\t By Yamin Hassan");
                Console.WriteLine("\n\tPlease use matric units to calculate your BMI" +
                                  "\t Please  Enter your height in Feet >");

                HeightFeet = ConsolHelper.GetInput();
                Console.WriteLine("Please enter your height in Inches");

                HeightInches = ConsolHelper.GetInput();
                Console.WriteLine($"\tWell you are {HeightFeet} feet and {HeightInches} Centimetres  tall");

                Console.WriteLine("\n\tPlease enter your weigt in stones >");
                WeightStone = ConsolHelper.GetInput();

                Console.WriteLine("Please enter your weight in Pounds");
                WeightLbs = ConsolHelper.GetInput();

                Console.WriteLine($"\tThanks for your weight. You weight: {WeightStone} Stones and {WeightLbs} Lbs");

                double Result = Math.Round(((WeightLbs + WeightStone * 14) / Math.Pow((HeightInches + HeightFeet * 12), 2)) * 703, 1);
                Console.WriteLine(Result);
                ConsolHelper.BmiResult(Result);


                String lastcommand = Console.ReadLine().ToLower();

                if (lastcommand == "yes")
                {
                    finish = true;
                    Choice();
                }
                else
                {
                    break;
                }
            }
        }
示例#9
0
        /// <summary>
        /// This method converts the input values to the output value
        /// </summary>
        public void PrintResults()
        {
            while (true)
            {
                FirstChoice  = dictionary.ElementAt(ConsolHelper.SelectChoice("\tPick 'From' the Unit in the List, you would like conversion", choices) - 1).Key;
                SecondChoice = dictionary.ElementAt(ConsolHelper.SelectChoice("\tPick 'To' the Unit in the List, you would like conversion", choices) - 1).Key;
                Amount       = ConsolHelper.GetInput("\tPlease select the amount\n");

                Console.WriteLine("The Result is:");
                Console.WriteLine(GetResult());
                Console.WriteLine("\tWould you like to another Conersion \n Yes \n No");
                String lastcommand = Console.ReadLine().ToLower();
                if (lastcommand == Yes)
                {
                    continue;
                }

                break;
            }
        }
        // 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();
            }
        }