Exemple #1
0
        public CalculationResultModel Volume(double weight, double density)
        {
            _calculationValidation.LessThanZero(weight, density, "Weight ", "Density");
            _calculationValidation.DivideByZero(density, "Density can not be 0");

            double Vloume = weight / density;

            return(_resultCreation.SetResult(Vloume, calculationModel.VolumeFormula, "Volume", calculationModel.VolumeUnit));
        }
        public CalculationResultModel Probability(int targetOutcomes, int totalOutcomes)
        {
            _calculationValidation.DivideByZero(totalOutcomes, $"Total Out Comes Can not be 0");

            double probability = targetOutcomes / totalOutcomes;

            probability *= 100;

            return(_resultCreation.SetResult(probability, MathFormula.Probability, "Probability", "%"));
        }
 private void LessThanZeroAndDivideChecks(double valueOne, double valueTwo, string valueOneName, string valueTwoName,
                                          double divideValue, string divideMessage)
 {
     _calculationValidation.DivideByZero(divideValue, divideMessage);
     _calculationValidation.LessThanZero(valueOne, valueTwo, valueOneName, valueTwoName);
 }