public static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Yellow;

            Console.WriteLine("BNU CO453 Applications Programming 2020-2021!");
            Console.WriteLine();
            string choice = Console.ReadLine();

            string[] choices = { " Distance Converter ", " BMI Calculator ", "Students Grades", " Social Network " };

            int choiceNo = ConsoleHelper.SelectChoice(choices);

            if (choiceNo == 1)
            {
                converter.ConvertDistance();
            }
            if (choiceNo == 2)
            {
                Calculator.OutputUnits();
            }
            if (choiceNo == 3)
            {
                calculator.CalculateMark();
            }
            if (choiceNo == 4)
            {
                app04.DisplayMenu();
            }
            else
            {
                Console.WriteLine("Invalid Choice !");
            }
        }
Exemple #2
0
        /// <summary>
        /// This method will print the heading title.
        /// conrol the color of the text.
        /// And run both distance converter and BMI application.
        /// </summary>
        /// <param name="args"></param>
        public static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Yellow;

            Console.WriteLine("BNU CO453 Applications Programming 2020-2021!");
            Console.WriteLine();
            Console.Beep();

            string [] choices = { " Distance Converter", " BMI Calculator", " Student Grades",
                                  " Social Network",     " RPG Game" };

            int choice = ConsoleHelper.SelectChoice(choices);

            if (choice == 1)
            {
                DistanceConverter converter = new DistanceConverter();
                converter.ConvertDistance();
            }
            else if (choice == 2)
            {
                App02.BMI calculator = new App02.BMI();
                calculator.Run();
            }
            else if (choice == 3)
            {
                StudentGrades grader = new StudentGrades();
                grader.Run();
            }
            else if (choice == 4)
            {
                SocialNetwork social = new SocialNetwork();
                social.Run();
            }
        }
        public static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Yellow;

            ConsoleHelper.OutputHeading("BNU CO453 Applications Programming 2020-2021!");
            Console.WriteLine();
            Console.Beep();
            DistanceConverter converter = new DistanceConverter();

            converter.ConvertDistance();

            ConsoleHelper.OutputHeading("\tBMI Calculator\n\tDaniel Hale");
            ConsoleHelper.OutputIntroduction("Thank you for using my BMI calculator. Please select either Metric or Imperial and type in your measurements.");

            BMI Calculator = new BMI();

            Calculator.OutputUnit();
            Calculator.GetUnit();
            Calculator.GetWeight();
            Calculator.GetHeight();
            Calculator.CalculateBMI();
            Calculator.OutputResult();

            ConsoleHelper.OutputHeading("\tStudent Grades\n\tDaniel Hale");
            ConsoleHelper.OutputIntroduction("Thank you for using my Student Grades app.");
        }
Exemple #4
0
        public static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Green;
            Console.Beep();

            ConsoleHelper.OutputHeading(" BNU CO453 Applications Programming 2020-2021!");

            string[] choices  = { "Distance Converter", "BMI Calculator", "Student Grades" };
            int      choiceNo = ConsoleHelper.SelectChoice(choices);

            if (choiceNo == 1)
            {
                converter.ConvertDistance();
            }

            if (choiceNo == 2)
            {
                calculator.CalculateIndex();
            }
            else if (choiceNo == 3)
            {
            }
            else if (choiceNo == 4)
            {
            }
            else
            {
                Console.WriteLine(" INVALID SELECTION CHOOSEN");
            }
        }
Exemple #5
0
        public static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Yellow;

            ConsoleHelper.OutputHeading("BNU CO453 Applications Programming 2020-2021!");

            string[] choices = { "Distance Converter", "BMI Calculater",
                                 "Student Grades",     "NetworkApp" };

            int choiceNo = ConsoleHelper.SelectChoice(choices);

            if (choiceNo == 1)
            {
                converter.ConvertDistance();
            }
            else if (choiceNo == 2)
            {
                calculator.CalculateIndex();
            }
            else if (choiceNo == 3)
            {
                studentGrades.OutputMenu();
            }
            else if (choiceNo == 4)
            {
                app04.DisplayMenu();
            }
            else
            {
                Console.WriteLine("Invalid choice ! ");
            }
        }
Exemple #6
0
        public static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.White;

            Console.WriteLine("BNU CO453 Applications Programming 2020-2021!");
            Console.WriteLine();

            Console.WriteLine("Options for the user");
            Console.WriteLine("Created by Chris Edgley");
            Console.WriteLine("-----------------------");
            Console.WriteLine("1. Distance Converter");
            Console.WriteLine("2. BMI Index");


            string options = Console.ReadLine();

            if (options == "1")
            {
                converter.ConvertDistance();
            }

            else if (options == "2")
            {
                index.CalcBMIIndex();
            }
        }
Exemple #7
0
 public IActionResult DistanceConverter(DistanceConverter converter)
 {
     if (converter.FromDistance > 0)
     {
         converter.ConvertDistance();
     }
     return(View(converter));
 }
Exemple #8
0
        public void TestMilesToFeet()
        {
            DistanceConverter converter = new DistanceConverter();

            converter.FromUnit     = DistanceUnits.Miles;
            converter.ToUnit       = DistanceUnits.Feet;
            converter.FromDistance = 1.0;

            converter.ConvertDistance();
            Assert.AreEqual(converter.ToDistance, 5280);
        }
Exemple #9
0
        public void TestMetersToMiles()
        {
            DistanceConverter converter = new DistanceConverter();

            converter.FromUnit     = DistanceUnits.Metres;
            converter.ToUnit       = DistanceUnits.Miles;
            converter.FromDistance = 1.0;

            converter.ConvertDistance();
            Assert.AreEqual(converter.ToDistance, 0.000621371);
        }
Exemple #10
0
        public void TestFeetToMeters()
        {
            DistanceConverter converter = new DistanceConverter();

            converter.FromUnit     = DistanceUnits.Feet;
            converter.ToUnit       = DistanceUnits.Metres;
            converter.FromDistance = 1.0;

            converter.ConvertDistance();
            Assert.AreEqual(converter.ToDistance, 0.3048);
        }
Exemple #11
0
        public void TestFeetToMiles()
        {
            DistanceConverter converter = new DistanceConverter();

            converter.FromUnit     = DistanceUnits.Feet;
            converter.ToUnit       = DistanceUnits.Miles;
            converter.FromDistance = 1.0;

            converter.ConvertDistance();
            Assert.AreEqual(converter.ToDistance, 0.000189394);
        }
Exemple #12
0
        public void TestMilesToMeters()
        {
            DistanceConverter converter = new DistanceConverter();

            converter.FromUnit     = DistanceUnits.Miles;
            converter.ToUnit       = DistanceUnits.Metres;
            converter.FromDistance = 1.0;

            converter.ConvertDistance();
            Assert.AreEqual(converter.ToDistance, 1609.34);
        }
        public static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Yellow;

            Console.WriteLine("BNU CO453 Applications Programming 2020-2021!");
            Console.WriteLine();
            Console.WriteLine("1. Distance Converter");
            Console.WriteLine("2. BMI Calculator");
            Console.WriteLine("3. Student Grades");
            Console.WriteLine("4. Social Network");
            Console.WriteLine("5. RPG Game");
            Console.WriteLine(" ==================== ");
            Console.WriteLine(" Select your application > ");
            Console.WriteLine(" ==================== ");
            string choice = Console.ReadLine();


            if (choice == "1")
            {
                DistanceConverter converter = new DistanceConverter();
                converter.ConvertDistance();
            }
            else if (choice == "2")
            {
                BMICalculator converter = new BMICalculator();
                converter.Run();
            }

            else if (choice == "3")
            {
                StudentGrades converter = new StudentGrades();
                converter.UserSelect();
            }

            else if (choice == "4")
            {
                App04.DisplayMenu();
            }

            else if (choice == "5")
            {
                throw new Exception();
            }

            else
            {
                Console.WriteLine("Invalid choice");
            }
        }
        public static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Yellow;

            Console.WriteLine("BNU CO453 Applications Programming 2020-2021!");
            Console.WriteLine();
            Console.Beep();

            DistanceConverter converter = new DistanceConverter();

            converter.ConvertDistance();

            BmiCalculator calculator = new BmiCalculator();

            calculator.CalculateBodyMassIndex();
        }
        public void ConvertMilesToFeet()
        {
            //Arrange
            converter.FromUnit     = DistanceUnits.Miles;
            converter.ToUnit       = DistanceUnits.Feet;
            converter.FromDistance = 5;

            //Act
            converter.ConvertDistance();

            //Assert
            Assert.That(converter.ToDistance, Is.EqualTo(26400));
        }
        public void TestMilesToFeet()
        {
            //Arrange

            DistanceConverter converter = new DistanceConverter();

            converter.FromUnit = DistanceConverter.MILES;
            converter.ToUnit   = DistanceConverter.FEET;

            converter.FromDistance = 1.0;

            // Act

            converter.ConvertDistance();
            double expectedDistance = 5280;

            // Assert

            Assert.AreEqual(expectedDistance, converter.ToDistance);
        }
Exemple #17
0
        public static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Red;

            Console.WriteLine("----------------------------------------------");
            Console.WriteLine("BNU CO453 Applications Programming 2020-2021!");
            Console.WriteLine("----------------------------------------------");
            Console.WriteLine();

            Console.WriteLine("1. Distance Converter");
            Console.WriteLine("2. BMI Calculator");
            Console.WriteLine("3. Student Marks");
            Console.WriteLine("4. Social Network");
            Console.WriteLine();



            Console.WriteLine("Please choose which app you would like to choose from > ");
            string choice = Console.ReadLine();

            if (choice == "1")
            {
                converter.ConvertDistance();
            }
            else if (choice == "2")
            {
                calculator.BMICalculation();
            }
            else if (choice == "3")
            {
                studentGrades.RunStudentGrades();
            }
            else if (choice == "4")
            {
                app04.DisplayMenu();
            }
            else
            {
                Console.WriteLine("Invalid Choice");
            }
        }
        public static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Yellow;

            Console.WriteLine("BNU CO453 Applications Programming 2020-2021!");
            Console.WriteLine();
            Console.WriteLine("1. Distance converter");
            Console.WriteLine("2. BMI calculator");
            Console.WriteLine("3. Student Grades calculator");
            Console.WriteLine("4. Social network application");
            Console.WriteLine("5. Ice, fire and wind RPS game");
            Console.WriteLine();
            string choice = Console.ReadLine();



            string[] choices = { " Distance Converter ", " BMI Calculator ", "Student Grades Calcuator", "Social network", "Ice and Wind Fire rps game" };

            int choiceNo = ConsoleHelper.SelectChoice(choices);

            if (choiceNo == 1)
            {
                converter.ConvertDistance();
            }
            if (choiceNo == 2)
            {
                Calculator.OutpuUnits();
            }
            if (choiceNo == 3)
            {
                calculator.CalculateMark();
            }
            if (choiceNo == 4)
            {
                app04.DisplayMenu();
            }
            if (choiceNo == 5)
            {
                app05.play();
            }
        }
Exemple #19
0
        public static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Yellow;


            Console.WriteLine();
            ConsoleHelper.OutputHeading("BNU CO453 Applications Programming 2020-2021!");

            string[] choices = { "Distance Converter", "BMI Calculator", "Student Grades",
                                 "Social Network",     "Rock-Paper-Scissors Game" };
            int      choiceNo = ConsoleHelper.SelectChoice(choices);


            String choice = Console.ReadLine();

            if (choiceNo == 1)
            {
                converter.ConvertDistance();
            }
            else if (choiceNo == 2)
            {
                calculator.CalculateIndex();
            }
            else if (choiceNo == 3)
            {
                grades.CalculateGrades();
            }
            else if (choiceNo == 4)
            {
                app04.DisplayMenu();
            }
            else if (choiceNo == 5)
            {
                app05.Play();
            }
            else
            {
                Console.WriteLine("Invalid Choice!");
            }
        }
Exemple #20
0
        public static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Blue;

            ConsoleHelper.OutputHeading("CO453 C# Programming - MAIN MENU", 0.2);
            string[] choices =
            {
                "APP01: Distance Converter",
                "APP02: BMI Calculator",
                "APP03: Student Grades System",
                "APP04: Social Network"
            };
            int choice = ConsoleHelper.SelectChoice(choices);

            if (choice == 1)
            {
                DistanceConverter converter = new DistanceConverter();
                converter.ConvertDistance();
            }
            if (choice == 2)
            {
                BMI bmi = new BMI();
                bmi.MainMenu();
            }
            if (choice == 3)
            {
                StudentGrades studentGrades = new StudentGrades();
                studentGrades.OutputHeading();
            }
            if (choice == 4)
            {
                NetworkApp networkApp = new NetworkApp();
                networkApp.DisplayMenu();
            }
            else
            {
                Console.WriteLine("Please make your choice");
            }
        }
Exemple #21
0
        public static void Main(string[] args)
        {
            // Starts application in the color yellow
            Console.ForegroundColor = ConsoleColor.Yellow;

            //Outputs the heading using parameters set
            ConsoleHelper.OutputHeading("BNU CO453 Applications Programming 2020-2021!");

            // Lists choices as an array using variables inputed
            string[] choices = { "Distance Converter", "BMI Calculator", "Student Marks", "Social Network" };

            // Selects a number equivalent to the array
            int choiceNo = ConsoleHelper.SelectChoice("Select a choice"
                                                      , choices);

            // If the number equals a choice listed, it opens a program
            // If else then Invalid entry
            if (choiceNo == 1)
            {
                converter.ConvertDistance();
            }
            else if (choiceNo == 2)
            {
                calculator.calculator();
            }
            else if (choiceNo == 3)
            {
                Marks.RunGradesApp();
            }
            else if (choiceNo == 4)
            {
                App04.DisplayMenu();
            }
            else
            {
                Console.WriteLine("Invalid Entry!");
            }
        }
Exemple #22
0
        public static void Main()
        {
            Console.ForegroundColor = ConsoleColor.Yellow;

            ConsoleHelper.OutputHeading("BNU CO453 Applications Programming 2020-2021!");

            string[] choices  = { "Distance Converter", "BMI Calculator", "Student Marks", "Social Network" };
            int      choiceNo = ConsoleHelper.SelectChoice(choices);

            switch (choiceNo)
            {
            case 1:
                DistanceConverter converter = new DistanceConverter();
                converter.ConvertDistance();
                break;

            case 2:
                BMI bmiindex = new BMI();
                bmiindex.ConvertBmi();
                break;

            case 3:
                StudentGrades studentGrades = new StudentGrades();
                studentGrades.StudentMenu();
                break;

            case 4:
                NetworkApp socialApp = new NetworkApp();
                socialApp.DisplayMenu();
                break;

            default:
                Console.WriteLine("Invalid Choice!");
                break;
            }
        }
Exemple #23
0
        public IActionResult Convert(DistanceConverter model)
        {
            if (model.FromUnit == DistanceUnits.NoUnit || model.ToUnit == DistanceUnits.NoUnit)
            {
                TempData["error"] = $"Units cannot be of type no unit!";
                return(View());
            }
            if (model.FromUnit == model.ToUnit)
            {
                TempData["error"] = $"Units cannot be a same type!";
                return(View());
            }
            if (model.FromDistance < 0 || model.FromDistance is 0.00d)
            {
                TempData["error"] = $"Distance value cannot be less than or equal zero or empty!";
                return(View());
            }

            model.ConvertDistance();

            TempData["result"] = $"{model.FromDistance} {model.FromUnit} is {model.ToDistance} {model.ToUnit}";

            return(View());
        }