Table of Contents

Interface IPercentCalculator

Namespace
SunamoShared._public.SunamoInterfaces.Interfaces
Assembly
SunamoShared.dll

Provides methods for calculating percentages from cumulative values.

public interface IPercentCalculator
Extension Methods

Properties

Last

Gets or sets the last computed value.

double Last { get; set; }

Property Value

double

OverallSum

Gets or sets the overall sum used as the 100% reference.

double OverallSum { get; set; }

Property Value

double

Methods

AddOnePercent()

Adds one percent to the computed sum.

void AddOnePercent()

Create(double)

Creates a new instance with the specified overall sum.

IPercentCalculator Create(double overallSum)

Parameters

overallSum double

The total sum representing 100%.

Returns

IPercentCalculator

PercentFor(double, bool)

Calculates the percentage for the given value.

int PercentFor(double value, bool isLast)

Parameters

value double

The value to calculate the percentage for.

isLast bool

Whether this is the last value in the sequence.

Returns

int

ResetComputedSum()

Resets the computed sum to zero.

void ResetComputedSum()