Max Hemmrich

Max Hemmrich

  • NA
  • 1
  • 14.3k

GPA Calulator - Converting Input to Value

Feb 2 2011 4:37 PM
I'm trying to code a GPA calculator in Visual Basic 08 for an independent enrichment and have everything set up and am pretty much done, except for the actual GPA calculation part. I have 8 combo boxes, one for each class, where the user can select their grade (A, A-, B+, etc). The part I'm stuck on is the conversion from a letter grade to the corresponding GPA, for example, A = 4.0, A- = 3.7.

I tried using an if statement:

string chineseGrade;
decimal chineseGPA;

if (chineseGrade("A"))
{
chineseGPA = 4.0;
}

but i keep getting the error that "chineseGrade is a variable but is being used as a method" and that "Literal of type double cannot be implicitly converted to type 'decimal'; use an 'M' suffix to create a literal of this type"

What can I do to solve these errors?

Answers (3)