Logic problem
Posted: Sun Oct 17, 2021 11:18 am
I am making an app that stores and manages school grades. There are classes that have numbers up to 10 as grades, such as 10, 9, 8 etc and classes that have letters as grades, such as A, B, C. I am trying to write a code to calculate the averages. I can calculate the averages for the numbers but I am having hard time finding the logic behind the averages for letters. Nobody knows how many letters are there that take part in the calculation process as a student may be examined 10 or 15 or 20 or even more times. I tried to replace letters with numbers, such as A with 10 and B with 8.5 (A covers 9 and 10, B covers 7 and
, and turn the average number to letter with something like that:
but the result is wrong. For example, let's say that we have one A and two B. The logic says the result is B. The above code returns A. Any ideas?
Code: Select all
If grade >=8.5
Result ="A"
Elseif grade >= 6.5
Result = "B"
EndIf