public static void Calculate(UserCoordinates userCoordinates, List <CoffeeShop> coffeeShopsList) { foreach (var coffeeShop in coffeeShopsList) { coffeeShop.DistanceToUser = HaversineDistanceCalculator.Calculate(userCoordinates.Latitude, userCoordinates.Longitude, coffeeShop.Latitude, coffeeShop.Longitude); } }
private static void Main(string[] terminalArguments) { DataProvidedValidator.Validate(terminalArguments); UserCoordinates userCoordinates = new UserCoordinates(); UserCoordinatesCapture.Capture(userCoordinates, terminalArguments); List <CoffeeShop> coffeeShopsList = new List <CoffeeShop>(); CoffeeShopDataCapture.Capture(coffeeShopsList, terminalArguments); CoffeeShopDistanceCalculator.Calculate(userCoordinates, coffeeShopsList); int numberOfDecimalsToRoundTheDistanceTo = 4; int numberOfClosestCoffeeShopsToShow = 3; ClosestCoffeeShopsFinder.Find(coffeeShopsList, numberOfClosestCoffeeShopsToShow, numberOfDecimalsToRoundTheDistanceTo); }