-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGrading.cs
46 lines (45 loc) · 1.36 KB
/
Grading.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
namespace GradingSystem
{
public class Grading
{
public static void GradeCalculator(string input)
{
if (int.TryParse(input, out int score))
{
if (score < 0)
{
Console.WriteLine($"Error: Score is lower than zero ({input})");
}
else if (score > 100)
{
Console.WriteLine($"Error: Score is over than hundred ({input})");
}
else if (score >= 80 && score <= 100)
{
Console.WriteLine("Grade: A (" + score + ")");
}
else if (score >= 70)
{
Console.WriteLine("Grade: B (" + score + ")");
}
else if (score >= 60)
{
Console.WriteLine("Grade: C (" + score + ")");
}
else if (score >= 50)
{
Console.WriteLine("Grade: D (" + score + ")");
}
else
{
Console.WriteLine("Grade: F (" + score + ")");
}
}
else
{
Console.WriteLine($"Error: Score should be in digit only ({input})");
}
}
}
}