






Create a grade display functions that will tell you a grade based on an integer percentage using the following guidelines:
1. Create a function called grade() returning either (a) a char if variable type is supported or (b) if not supported return a string. An int variable should be passed into grade().
The value returned should be A - F. Use the following table to figure out which grade to return:
A : 90-100%
B : 80-89%
C : 70-79%
D : 60 - 69%
F : 59% and below
2. Create a function called gradeA() which returns a string of their grade including pluses and minuses. eg. A-, A, and A+. An int variable should be passed into gradeA().
The value should also return A - F based on the first table but with pluses and minuses.
Example
----------------
60-62% = D-
63-66% = D
67-69% = D+
and
90-92% = A-
93-96% = A
97-100% = A+
I've provided an example on the following post of my submission in C#.
Offline







Submission example in C#
static char grade(int percent)
{
char[] g = { 'F', 'D', 'C', 'B', 'A'};
int v = (percent - 50) / 10;
v -= v > 4 ? 1 : 0;
v = v < 0 ? 0 : v;
return g[v];
}
static string gradeA(int percent)
{
if (percent == 100) return "A+";
char g = grade(percent);
char[] gd = { '-', (char)0, '+' };
int v = (percent % 10);
v = v == 6 ? v / 3 - 1: v / 3;
v = v > 2 ? 2 : v;
string x = Convert.ToString(g); x += gd[v];
return x;
}Offline