public CalculationResultModel Weight(double vloume, double density) { _calculationValidation.LessThanZero(vloume, density, "Volume ", "Density"); double Weight = vloume * density; return(_resultCreation.SetResult(Weight, calculationModel.WeightFormula, "Weight", calculationModel.WeightUnit.ToString())); }
public CalculationResultModel Mean(List <double> values) { int totalNumbers = values.Count; double sumOfValues = 0; double average; _calculationValidation.ListHasNoValues(values); foreach (var item in values) { sumOfValues += item; } average = sumOfValues / totalNumbers; return(_resultCreation.SetResult(average, MathFormula.Mean, "Mean")); }
public CalculationResultModel Ohm_VoltageCalculation(double current, double resistance) { _calculationValidation.LessThanZero(current, resistance, "Current", "Resistance"); double Voltage = current * resistance; return(_resultCreation.SetResult(Voltage, ohmLaw.OhmLawFormula, "Voltage")); }