public string ParseParcel(string[] dimensionsAndWeight) { try { var parcel = parcelFactory.CreateParcel(dimensionsAndWeight); if (weighingService.IsOverMaxWeight(parcel)) { var maxWeight = weighingService.GetMaxWeight(); return($"Parcels heavier than {maxWeight}kg cannot be shipped."); } if (pricingService.IsOverMaxSize(parcel)) { return(GetOverMaxSizeMessage()); } var cost = pricingService.CalculateShippingCost(parcel); if (cost == null) { return(GetOverMaxSizeMessage()); } return($"Cost to ship parcel: ${cost.Value.ToString("#,0.00")}"); } catch (InvalidNumberOfArgumentsException) { return("Please enter all three dimensions of the parcel and its weight.\n" + "Usage: dotnet run <length> <breadth> <height> <weight>"); } catch (InvalidArgumentTypeException) { return("Please enter only numeric values."); } catch (InvalidArgumentValueException) { return("Please enter values greater than 0."); } }