0

Ok so I have a program to read three exam scores from 6 students. I have to make the program average the 3 exam scores for each student and then have an average for each invidual exam. Then have a total average for every score there.

Blah I can't get it to work and I have been sitting here trying to figure it out for along time. Here's the code so far. And its alot.

```
'John Stonebraker
' Program to compute average of the exams
' Variables Used
' Nam$ Name of worker
' Exam1 Score on exams
' Exam2 " "
' Exam3 " "
' Average
' Average1
' Average2
' Average3
' AverageFinal
' AverageFinal1
' OverallGrade$
' Grade1$
' Grade2$
' Grade3$
' AverageExam1
' AverageExam2
' AverageExam3
' FinalGrade1$
' FinalGrade2$
' FinalGrade3$
' FinalGrade4$
' T1$, H1$, D1$, H2$, TL$, TL1$, TL2$
'Program Mainline***********************************************************
CLS
GOSUB InitializeImages
GOSUB PrintHeadings
GOSUB ProcessDetail
GOSUB PrintTotals
END
'Initialize Images**********************************************************
InitializeImages:
LET T1$ = " Scores"
LET H1$ = "StudentName Exam 1 Exam 2 Exam 3 Average"
LET D1$ = "\ \ \ \ \ \ \ \ \ \"
LET TL$ = "Class Average Exam 1 Exam 2 Exam 3"
LET TL1$ = " \ \ \ \ \ \"
LET TL2$ = "Average of all scores- \ \"
RETURN
'Print Headings*************************************************************
PrintHeadings:
PRINT
PRINT T1$
PRINT
PRINT H1$
PRINT
PRINT
RETURN
'Process Detail*************************************************************
ProcessDetail:
GOSUB ReadData
DO UNTIL UCASE$(Nam$) = "END"
GOSUB CalculateAnswers
GOSUB PrintDetail
GOSUB ReadData
LOOP
RETURN
'Read Input Data************************************************************
ReadData:
READ Nam$, Exam1, Exam2, Exam3
DATA Jo Smith, 70, 80, 90
DATA Ed Lynn, 40, 65, 59
DATA Richard Johnson, 86, 93, 72
DATA Linda Harris, 95, 75, 86
DATA Wendy Williams, 77, 83, 78
DATA David Rudolph, 55, 83, 78
DATA END, 0, 0, 0
RETURN
'Calculate Answers*********************************************************
CalculateAnswers:
IF Exam1 < 60 THEN
LET Grade1$ = "F"
END IF
IF Exam1 >= 60 AND Exam1 <= 69 THEN
LET Grade1$ = "D"
END IF
IF Exam1 >= 70 AND Exam1 <= 79 THEN
LET Grade1$ = "C"
END IF
IF Exam1 >= 80 AND Exam1 <= 89 THEN
LET Grade1$ = "B"
END IF
IF Exam1 >= 90 THEN
LET Grade1$ = "A"
END IF
IF Exam2 < 60 THEN
LET Grade2$ = "F"
END IF
IF Exam2 >= 60 AND Exam2 <= 69 THEN
LET Grade2$ = "D"
END IF
IF Exam2 >= 70 AND Exam2 <= 79 THEN
LET Grade2$ = "C"
END IF
IF Exam2 >= 80 AND Exam2 <= 89 THEN
LET Grade2$ = "B"
END IF
IF Exam2 >= 90 THEN
LET Grade2$ = "A"
END IF
IF Exam3 < 60 THEN
LET Grade3$ = "F"
END IF
IF Exam3 >= 60 AND Exam3 <= 69 THEN
LET Grade3$ = "D"
END IF
IF Exam3 >= 70 AND Exam3 <= 79 THEN
LET Grade3$ = "C"
END IF
IF Exam3 >= 80 AND Exam3 <= 89 THEN
LET Grade3$ = "B"
END IF
IF Exam3 >= 90 THEN
LET Grade3$ = "A"
END IF
LET Average = Exam1 + Exam2 + Exam3 / 3
IF Average < 60 THEN
LET FinalGrade1$ = "F"
END IF
IF Average >= 60 AND Average <= 69 THEN
LET FinalGrade1$ = "D"
END IF
IF Average >= 70 AND Average <= 79 THEN
LET FinalGrade1$ = "C"
END IF
IF Average >= 80 AND Average <= 89 THEN
LET FinalGrade1$ = "B"
END IF
IF Average >= 90 THEN
LET FinalGrade1$ = "A"
END IF
LET AverageExam1 = AverageExam1 + Exam1
LET Average1 = AverageExam1 / 6
IF Average1 < 60 THEN
LET FinalGrade2$ = "F"
END IF
IF Average1 >= 60 AND Average1 <= 69 THEN
LET FinalGrade2$ = "D"
END IF
IF Average1 >= 70 AND Average1 <= 79 THEN
LET FinalGrade2$ = "C"
END IF
IF Average1 >= 80 AND Average1 <= 89 THEN
LET FinalGrade2$ = "B"
END IF
IF Average1 >= 90 THEN
LET FinalGrade2$ = "A"
END IF
LET AverageExam2 = AverageExam2 + Exam2
LET Average2 = AverageExam2 / 6
IF Average2 < 60 THEN
LET FinalGrade3$ = "F"
END IF
IF Average2 >= 60 AND Average2 <= 69 THEN
LET FinalGrade3$ = "D"
END IF
IF Average2 >= 70 AND Average2 <= 79 THEN
LET FinalGrade3$ = "C"
END IF
IF Average2 >= 80 AND Average2 <= 89 THEN
LET FinalGrade3$ = "B"
END IF
IF AverageExam2 >= 90 THEN
LET FinalGrade3$ = "A"
END IF
LET AverageExam3 = AverageExam3 + Exam3
LET Average3 = AverageExam3 / 6
IF Average3 < 60 THEN
LET FinalGrade4$ = "F"
END IF
IF Average3 >= 60 AND Average3 <= 69 THEN
LET FinalGrade4$ = "D"
END IF
IF Average3 >= 70 AND Average3 <= 79 THEN
LET FinalGrade4$ = "C"
END IF
IF Average3 >= 80 AND Average3 <= 89 THEN
LET FinalGrade4$ = "B"
END IF
IF Average3 >= 90 THEN
LET FinalGrade4$ = "A"
END IF
LET AverageFinal = AverageFinal + AverageExam1 + AverageExam2 + AverageExam3
LET AverageFinal1 = AverageFinal1 / 18
IF AverageFinal1 < 60 THEN
LET OverallGrade$ = "F"
END IF
IF AverageFinal1 >= 60 AND AverageFinal1 <= 69 THEN
LET OverallGrade$ = "D"
END IF
IF AverageFinal1 >= 70 AND AverageFinal1 <= 79 THEN
LET OverallGrade$ = "C"
END IF
IF AverageFinal1 >= 80 AND AverageFinal1 <= 89 THEN
LET OverallGrade$ = "B"
END IF
IF AverageFinal1 >= 90 THEN
LET OverallGrade$ = "A"
END IF
RETURN
'Print Detail**************************************************************
PrintDetail:
PRINT USING D1$; Nam$; Grade1$; Grade2$; Grade3$; FinalGrade1$
RETURN
'Print Totals**************************************************************
PrintTotals:
PRINT
PRINT TL$
PRINT USING TL1$; FinalGrade2$; FinalGrade3$; FinalGrade4$
PRINT
PRINT USING TL2$; OverallGrade$
'End of Program************************************************************
```

I don't know how to print out the output screen but so far I can't get the averages of each student correct, average of each individual exam, and a average of every single score from each exam. The problem has to be with the Ifs and Thens.

Any help would be appreciated. ;)