Example #1
0
        public void displayMenu()
        {
            int choice = 0;

            while (choice != 9)
            {
                ConsoleHelper.OutputText("1. Add a message post\n" +
                                         "2. Add a photo or image post\n" +
                                         "3. Display all posts\n" +
                                         "4. Display posts by date\n" +
                                         "5. Display posts by author\n" +
                                         "6. Remove a post\n" +
                                         "7. Add comments for a post\n" +
                                         "8. like unlike posts\n" +
                                         "9. unlike posts\n" +
                                         "10. select post\n" +
                                         "11. Quit\n");
                choice = ConsoleHelper.getMark(1, 11);
                if (choice == 1)
                {
                    postMessage();
                }
                else if (choice == 2)
                {
                    postImage();
                }
                else if (choice == 3)
                {
                    displayAll();
                }
                else if (choice == 4)
                {
                    displayByDate();
                }
                else if (choice == 5)
                {
                    displayByAuthor();
                }
                else if (choice == 6)
                {
                    removePost();
                }
                else if (choice == 7)
                {
                    addComment();
                }
                else if (choice == 8)
                {
                    likePosts();
                }
                else if (choice == 9)
                {
                    unlikePosts();
                }
                else if (choice == 10)
                {
                    selectPost();
                }
            }
        }
Example #2
0
        ///<summary>
        /// Method posts messages.
        ///</summary>
        private void postMessage()
        {
            ConsoleHelper.OutputText("Enter a message to post: ");
            string      message     = ConsoleHelper.InputText();
            MessagePost messagePost = new MessagePost(username, message);

            newsFeed.AddMessagePost(messagePost);
        }
Example #3
0
        ///<summary>
        /// Method posts images.
        ///</summary>
        private void postImage()
        {
            ConsoleHelper.OutputText("Enter an image to post: ");
            string    photo     = ConsoleHelper.InputText();
            PhotoPost photoPost = new PhotoPost(username, filename, caption);

            newsFeed.AddPhotoPost(photoPost);
        }
Example #4
0
        ///<summary>
        /// Method dislikes posts.
        ///</summary>
        private void unlikePosts()
        {
            bool like = false;

            ConsoleHelper.OutputText("Enter Post ID: ");
            int postID = ConsoleHelper.getMark(1, 10);

            newsFeed.UnlikePost(postID);
        }
Example #5
0
 ///<summary>
 /// Method runs application.
 ///</summary>
 public void run()
 {
     ConsoleHelper.OutputText("---------------\n" +
                              "    Network    \n" +
                              "By Ben Bricker \n" +
                              "---------------\n");
     inputName();
     newsFeed = new NewsFeed();
     displayMenu();
 }
Example #6
0
        ///<summary>
        /// Method adds comments.
        ///</summary>
        private void addComment()
        {
            ConsoleHelper.OutputText("Enter Post ID: ");
            int postID = ConsoleHelper.getMark(1, 10);

            ConsoleHelper.OutputText("Enter Comment: ");
            string comment = ConsoleHelper.InputText();

            newsFeed.AddComment(postID, comment);
        }
Example #7
0
        ///<summary>
        /// Method allows student marks to be entered.
        ///</summary>
        private void enterStudentMarks()
        {
            while (true)
            {
                ConsoleHelper.OutputText("Enter mark for student " + nextStudentID + " from 0 to 100, -1 to quit");
                int mark = ConsoleHelper.getMark(-1, 100);
                if (mark == -1)
                {
                    break;
                }

                addStudent(mark);
            }
        }
Example #8
0
        public void run()
        {
            ConsoleHelper.OutputText("---------------\n" +
                                     "BMI Calculator \n" +
                                     "By Ben Bricker \n" +
                                     "---------------\n");

            ConsoleHelper.OutputText("1. Metric Units\n" +
                                     "2. Imperial Units");

            BMIUnits units = ConsoleHelper.SelectBMIChoice();

            if (units == BMIUnits.METRIC)
            {
                double height = ConsoleHelper.getHeightMetres();
                double weight = ConsoleHelper.getWeightKg();

                BMI = weight / (height * height);
            }

            else if (units == BMIUnits.IMPERIAL)
            {
                int    heightFeet   = ConsoleHelper.getHeightFeet();
                int    heightInches = ConsoleHelper.getHeightInches();
                int    weightStones = ConsoleHelper.getWeightStones();
                double weightPounds = ConsoleHelper.getWeightPounds();

                heightInches += (heightFeet * 12);
                weightPounds += (weightStones * 14);
                BMI           = (weightPounds * 703) / (heightInches * heightInches);
            }
            else
            {
                BMI = 0.0;
            }
            if (Double.IsInfinity(BMI))
            {
                ConsoleHelper.OutputText("Entered height is zero, cannot calculate BMI");
            }
            else
            {
                weightStatus();
            }
        }
Example #9
0
        ///<summary>
        /// Method method calls methods to run student marks.
        ///</summary>
        public void run()
        {
            ConsoleHelper.OutputText("---------------\n" +
                                     "Student Marks \n" +
                                     "By Ben Bricker \n" +
                                     "---------------\n");
            enterStudentMarks();
            calculateStats();
            calculateGradeProfile();

            ConsoleHelper.OutputText("Here is a list of the student marks");
            foreach (Student aStudent in Students)
            {
                aStudent.display();
            }

            ConsoleHelper.OutputText("\n Mean mark: " + MeanMark + ", Lowest mark: " + MinMark + ", Highest mark: " + MaxMark);
            ConsoleHelper.OutputText("\n Grade Profile based on " + Students.Count + " Students. \n First Class Percentage: " + PercentageFirstClass +
                                     "\n Upper Class Percentage: " + PercentageUpperSecondClass +
                                     "\n Lower Class Percentage: " + PercentageLowerSecondClass +
                                     "\n Third Class Percentage: " + PercentageThirdClass +
                                     "\n Failed Percentage: " + PercentageFailed);
        }
Example #10
0
        ///<summary>
        /// Method uses statements to show what someones' BMI and status is.
        ///</summary>
        private void weightStatus()
        {
            string status;

            if (BMI < 18.50)
            {
                status = "Underweight";
            }
            else if (BMI < 25.0)
            {
                status = "Normal";
            }
            else if (BMI < 30.0)
            {
                status = "Overweight";
            }
            else if (BMI < 35.0)
            {
                status = "Obese Class I";
            }
            else if (BMI < 40.0)
            {
                status = "Obese Class II";
            }
            else
            {
                status = "Obese Class III";
            }

            ConsoleHelper.OutputText("Your BMI is " + BMI + ", You are in " + status + " range!");

            ConsoleHelper.OutputText("If you are Black, Asian or other minority\n" +
                                     "ethnic groups, you have a higher risk" +

                                     "Adults 23.0 or more are at increased risk\n" +
                                     "Adults 27.5 or more are at high risk");
        }
Example #11
0
 ///<summary>
 /// Method inputs name.
 ///</summary>
 private void inputName()
 {
     ConsoleHelper.OutputText("Enter a name: ");
     username = ConsoleHelper.InputText();
 }
Example #12
0
 ///<summary>
 ///  Method shows student information.
 ///</summary>
 public void display()
 {
     ConsoleHelper.OutputText("Student ID: " + studentID + " Mark: " + mark + " Grade: " + classification);
 }