You have a very large outer
if
/
else if
missing an
else
, so not all paths result in initialising the
lettergrade
variable. Initializing with an empty string should resolve it:
lettergrade = "";
A side comment: I would suggest simplifying your tests.