The answer will depend on how you have setup your domain model and how you are storing grades. You will need to share more details on how your domain model is setup, what the criteria for grade boundaries are, etc, before we can help.