Last active
August 23, 2019 16:52
-
-
Save shadow1349/82504d5aa6c3a11327ee726b9b1a7bf1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Grader.Service | |
{ | |
public class GradeConverter | |
{ | |
/// <summary> | |
/// 90 and above = 'A' | |
/// 80 - 90 = 'B' | |
/// 70 - 80 = 'C' | |
/// 60 - 70 = 'D' | |
/// 60 and below = 'F' | |
/// </summary> | |
/// <param name="grade"></param> | |
/// <returns>Letter grade</returns> | |
public char GetLetterGrade(int grade) | |
{ | |
if (grade > 90) | |
{ | |
return 'A'; | |
} | |
if (grade < 90 && grade > 80) | |
{ | |
return 'B'; | |
} | |
if (grade < 80 && grade > 70) | |
{ | |
return 'C'; | |
} | |
if (grade < 70 && grade > 60) | |
{ | |
return 'D'; | |
} | |
if (grade < 60) | |
{ | |
return 'F'; | |
} | |
return 'F'; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment