Calculate a Statistic
We have already store our data. Now, we perform some calculation analysis on it.
First, we want to have conversion rate. It is goals divided by shots. We have to make properties to store that data.
We do this inside GameResult class.
public Double ConversionRate
{
get
{
return (double) Goals / (double) GoalAttempts;
}
}
Using this way, the calculation will performed every number of Goals or GoalAttempts changed.