isGoldenRanking function

bool isGoldenRanking({
  1. required int rank,
  2. required int total,
})

Returns whether a specific rank out of total qualifies for the academic award.

Requires positive rank and total, and rank must be within the award quota: rank <= (total - 1) ~/ 20 + 1.

Implementation

bool isGoldenRanking({required int rank, required int total}) {
  if (total <= 0 || rank <= 0) return false;
  return rank <= getAwardQuota(total);
}