I am new to linux and am trying to get help with a problem that I have been working on for awhile. I am supossed to use awk to find the average gpa. the file is set up so the the letter grade is in field 4 and the courses credits are in field 3. The command below is the last one that I came up with but it prints out the GPA is nan. I am just not sure what i am doing wrong.

awk 'BEGIN {gpa_total=0.0;course_total=$3;count=0}{if ($4=A){gpa=$3*4; gpa_total+=gpa;count++;}}{if ($4=B){gpa=$3*3; gpa_total+=gpa;count++}};{if($4=C){gpa=$3*2; gpa_total+=gpa;count++;}}{if ($4=D){gpa=$3*1; gpa_total+=gpa;count++;}}{if ($4=F){gpa=$3*0; gpa_total+=gpa;count++;}} END {print "GPA is" gpa_total/course_total}' grades.txt