Sorry if I am not clear:
How would I calculate the average rating based on the MinRate and MaxRate
for example: minRate = 0 or 1 and MaxRate = 2 or 3 or 4 or 5 or 0
How would I calculate the rating?
Update End
I am implementing a 5 star rating system and my table structure has two columns: 1) MinRate 2) MaxRate
so my question is: how do calculate the average rating?
here is how I have in my 5 star rating implementation.
int[] {7, 0, 0, 8, 5};
This means that:
Here is some pseudo code:
double avg = 0;
for (int i = 0; i < arr.Length; i++) // arr.Length should be the same as MaxRate
{
avg += arr[i] * (i + MinRate);
}
avg /= arr.length;