public double GetDistanceInMiles(double latitude, double longitude, double otherLatitude, double otherLongitude)
        {
            var distanceInMetres = GetDistanceInMetres(latitude, longitude, otherLatitude, otherLongitude);
            var distanceInMiles  = DistanceConverter.MetresToMiles(distanceInMetres);

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

            Console.WriteLine("BNU CO453 Applications Programming!");
            Console.WriteLine("1: Distance converter");
            Console.WriteLine("2: BMI Calculator");
            Console.WriteLine("3: StudentMarks");
            Console.WriteLine("4: Social Network");
            Console.WriteLine("Please choose your desired Program > ");
            string choice = Console.ReadLine();

            if (choice == "1")
            {
                DistanceConverter converter = new DistanceConverter();
                converter.Run();
            }
            else if (choice == "2")
            {
                App02.BMI converter = new App02.BMI();
                converter.run();
            }
            else if (choice == "3")
            {
                App04.DisplayMenu();
            }
        }
        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
        private static double GetLengthInMapUnits(IActiveView activeView, double mm)
        {
            if (activeView == null)
            {
                return(-1);
            }

            IScreenDisplay         screenDisplay         = activeView.ScreenDisplay;
            IDisplayTransformation displayTransformation = screenDisplay.DisplayTransformation;
            var dpi    = displayTransformation.Resolution;
            var inches = mm / 25.4;

            tagRECT deviceRect  = displayTransformation.get_DeviceFrame();
            int     pixelExtent = (deviceRect.right - deviceRect.left);

            var pixels = dpi * inches;
            IDistanceConverter distanceConverter = new DistanceConverter();

            IEnvelope envelope = displayTransformation.VisibleBounds;
            double    realWorldDisplayExtent = envelope.Width;

            if (pixelExtent == 0)
            {
                return(-1);
            }

            var sizeOfOnePixel = (realWorldDisplayExtent / pixelExtent);

            return(pixels * sizeOfOnePixel);
        }
        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.Run();
            }
            else if (choice == 2)
            {
                BMI calculator = new App02.BMI();
                calculator.Run();
            }
            else if (choice == 3)
            {
                StudentMarks grader = new StudentMarks();
                grader.Run();
            }
            else if (choice == 4)
            {
                SocialNetworkMain social = new SocialNetworkMain();
                social.Run();
            }
        }
Exemple #6
0
        public static void Main(string[] args)
        {
            //Console.ForegroundColor = ConsoleColor.Black;

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

            string[] choice = { "Distance Converter", "BMI Calculator",
                                "Student Marks",      "Social Network" };


            int choiceNo = ConsoleHelper.SelectChoices(choice);

            if (choiceNo == 1)
            {
                DistanceConverter converter = new DistanceConverter();
                converter.Run();
            }
            else if (choiceNo == 2)
            {
                BMI calculator = new BMI();
                calculator.Run();
            }
            else if (choiceNo == 3)
            {
                StudentGrades studentGrades = new StudentGrades();
                studentGrades.Run();
            }
            else if (choiceNo == 4)
            {
                app04.DisplayMenu();
            }
        }
Exemple #7
0
        public static void Main(string[] args)
        {
            Console.Clear();
            Console.ForegroundColor = ConsoleColor.White;

            Console.WriteLine("BNU CO453 Applications Programming Jan start");
            Console.WriteLine("Abbas Raziq");
            Console.WriteLine();

            string[] choices = new string[]
            {
                "Distance Coverter",
                "BMI Calculator",
            };

            ConsoleHelper.OutputTitle("Please select the application you wish to use ");
            choice = ConsoleHelper.SelectChoice(choices);

            if (choice == 1)
            {
                DistanceConverter converter = new DistanceConverter();
                converter.Run();
            }
            else if (choice == 2)
            {
                BMI calculator = new BMI();
                calculator.Run();
            }
        }
Exemple #8
0
 public static dynamic GetTSObject(DistanceConverter dynObject)
 {
     if (dynObject is null)
     {
         return(null);
     }
     return(dynObject.teklaObject);
 }
Exemple #9
0
 public IActionResult DistanceConverter(DistanceConverter converter)
 {
     if (converter.FromDistance > 0)
     {
         converter.ConvertDistance();
     }
     return(View(converter));
 }
Exemple #10
0
 static void PrintMeterToFeetList(int start, int stop)
 {
     for (int meter = start; meter <= stop; meter++)
     {
         double feet = DistanceConverter.MeterToFeet(meter);
         Console.WriteLine("{0} m = {1:0.0000} feet", meter, feet);
     }
 }
Exemple #11
0
 static void PrintFeetToMeterList(int start, int stop)
 {
     for (int feet = start; feet <= stop; feet++)
     {
         double meter = DistanceConverter.FeetToMeter(feet);
         Console.WriteLine("{0} ft = {1:0.0000} m", feet, meter);
     }
 }
Exemple #12
0
        public static void Main(string[] args)
        {
            while (true)
            {
                //Creating an object of the distance converter
                DistanceConverter converter = new DistanceConverter();

                //Creating an object of the BMI calculator
                BMI bmi = new BMI();

                //Creating an object of the student grades
                StudentGrades grades = new StudentGrades();

                NetworkApp app04 = new NetworkApp();

                Console.ForegroundColor = ConsoleColor.Yellow;

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

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

                int choiceNo = ConsoleHelper.SelectChoice(choices);

                /**
                 * Uses if statements and a while loop and list of strings to allow user to
                 * decide on which application they wish to use based upon their inputted number
                 * 1-4
                 * 5 Is a Quit choice which will break the loop and end the application
                 */

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

                else if (choiceNo == 2)
                {
                    bmi.BMICalculator();
                }

                else if (choiceNo == 3)
                {
                    grades.ChooseMethod();
                }
                else if (choiceNo == 4)
                {
                    app04.DisplayMenu();
                }
                else if (choiceNo == 5)
                {
                    break;
                }
                else
                {
                    Console.WriteLine("\nYou have entered an invalid choice");
                }
            }
        }
Exemple #13
0
        public ActionResult <IEnumerable <string> > Get(double unitVal, string UnitOfMeasureFrom, string UnitOfMeasureTo)
        {
            double lbValue;
            var    convertor = new DistanceConverter(UnitOfMeasureFrom, UnitOfMeasureTo);

            lbValue = convertor.LeftToRight(unitVal);

            return(new string[] { unitVal.ToString() + " " + UnitOfMeasureFrom, lbValue.ToString() + " " + UnitOfMeasureTo });
        }
Exemple #14
0
        public void m_mm()
        {
            converter = new DistanceConverter("m", "mm");
            double valL = 1;
            double valR = 1000;

            Assert.AreEqual(valR, converter.LeftToRight(valL));
            Assert.AreEqual(valL, converter.RightToLeft(valR));
        }
        public void TestFeetToMiles()
        {
            DistanceConverter converter = new DistanceConverter();

            double feet  = 5280;
            double miles = converter.FeetToMiles(feet);

            Assert.AreEqual(miles, 1.00);
        }
Exemple #16
0
        public void m_au()
        {
            converter = new DistanceConverter("m", "au");
            double valL = 149600000000;
            double valR = 1;

            Assert.AreEqual(valR, converter.LeftToRight(valL, 4));
            Assert.AreEqual(valL, converter.RightToLeft(valR, 4));
        }
Exemple #17
0
        public void m_yd()
        {
            converter = new DistanceConverter("m", "yard");
            double valL = 1;
            double valR = 1.09361;

            Assert.AreEqual(valR, converter.LeftToRight(valL, 5));
            Assert.AreEqual(valL, converter.RightToLeft(valR, 5));
        }
Exemple #18
0
        public void m_in()
        {
            converter = new DistanceConverter("m", "inch");
            double valL = 1;
            double valR = 39.3701;

            Assert.AreEqual(valR, converter.LeftToRight(valL, 4));
            Assert.AreEqual(valL, converter.RightToLeft(valR, 4));
        }
        public void TestMilesToFeet()
        {
            DistanceConverter converter = new DistanceConverter();

            double miles = 1;
            double feet  = converter.MilesToFeet(miles);

            Assert.AreEqual(feet, 5280);
        }
Exemple #20
0
        public void m_ft()
        {
            converter = new DistanceConverter("m", "feet");
            double valL = 1;
            double valR = 3.28084;

            Assert.AreEqual(valR, converter.LeftToRight(valL, 5));
            Assert.AreEqual(valL, converter.RightToLeft(valR, 5));
        }
        public void TestMetresToFeet()
        {
            DistanceConverter converter = new DistanceConverter();

            converter.metres = 1.0;
            converter.CalculateMetresToFeet();
            double expectedDistance = 3.28084;

            Assert.AreEqual(expectedDistance, converter.feet);
        }
        public void TestMetresToMiles()
        {
            DistanceConverter converter = new DistanceConverter();

            converter.metres = 1608.34;
            converter.CalculateMetresToMiles();
            double expectedDistance = 1.0;

            Assert.AreEqual(expectedDistance, converter.miles);
        }
        public void TestFeetToMiles()
        {
            DistanceConverter converter = new DistanceConverter();

            converter.feet = 5280;
            converter.CalculateMiles();
            double expectedDistance = 1;

            Assert.AreEqual(expectedDistance, converter.miles);
        }
        public void TestMilesToFeet()
        {
            DistanceConverter converter = new DistanceConverter();

            converter.miles = 5;
            converter.CalculateFeet();
            double expectedDistance = 26400;

            Assert.AreEqual(expectedDistance, converter.feet);
        }
        public void TestFeetToMetres()
        {
            DistanceConverter converter = new DistanceConverter();

            converter.feet = 3.2;
            converter.CalculateFeetToMetres();
            double expectedDistance = 1;

            Assert.AreEqual(expectedDistance, Math.Round(converter.metres, 1));
        }
Exemple #26
0
 public UberPrice(Guid productId, string currencyCode, string priceEstimate, string lowEstimate, string highEstimate, int durationInSeconds, double distanceInMiles)
 {
     this.ProductId         = productId;
     this.CurrencyCode      = currencyCode;
     this.PriceEstimate     = priceEstimate;
     this.LowEstimate       = lowEstimate;
     this.HighEstimate      = highEstimate;
     this.DurationInSeconds = durationInSeconds;
     this.DistanceInMeters  = DistanceConverter.MilesToMeters(distanceInMiles);
 }
Exemple #27
0
        public static void Main()
        {
            Console.ForegroundColor = ConsoleColor.Yellow;

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

            Console.WriteLine("1. Distance converter");
            Console.WriteLine("2. BMI Calculator");
            Console.WriteLine("3. Student Grades");
            Console.WriteLine("4. Student Grades");
            Console.WriteLine("5. Student Grades");

            Console.WriteLine(0);

            Console.WriteLine("Select an applocation  ");
            string choice = Console.ReadLine();

            if (choice == "1")
            {
                DistanceConverter converter = new DistanceConverter();
                converter.MilesToFeet();
                converter.MetresToMiles();
                converter.KilometresToMiles();
                converter.MilesToFeet2();
                converter.MetresToMiles2();
                converter.KilometresToMiles2();
                converter.MetresTofeet();
                converter.FeetToMetres();
            }
            else if (choice == "2")
            {
            }
            else if (choice == "3")
            {
                StudentMarks students = new StudentMarks();
                students.Run();
            }
            else if (choice == "4")
            {
                Socialnet social = new Socialnet();
                social.Run();
            }
            else if (choice == "5")
            {
                StudentMarks students = new StudentMarks();
                students.Run();
            }


            // BMI calculator = new BMI();
            // BMI();
            //     Console.ReadLine();
        }
Exemple #28
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 #29
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 #30
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);
        }
 public void TestConverter()
 {
     DistanceConverter converter = new DistanceConverter();
     Assert.AreEqual(8.04672, converter.FromMilesToKm(5), 0.001d);
 }