public bool CheckPercentageAccuracy() { bool pass = true; decimal percentDiff = Paystubs.Max(x => x.Percent) - Paystubs.Min(x => x.Percent); if (percentDiff > (decimal)Accuracy) { pass = false; } PercentageDifference = percentDiff; return(pass); }
/// <summary> /// Finds the difference of the min and max percentages and compares that to the users desired accuracy tolerance. /// </summary> /// <returns>Returns true if the check passes.</returns> private bool CheckConvertedPercentageAccuracy() { bool pass = true; decimal calcAccuracy = 0; decimal percentDiff = Paystubs.Max(x => x.Percent) - Paystubs.Min(x => x.Percent); if (percentDiff != 0) { calcAccuracy = percentDiff / 100; } if (calcAccuracy > (decimal)Accuracy) { pass = false; } PercentageDifference = percentDiff; return(pass); }