Newbie to QB - I have an assignment to create a grade sheet for one student. Must list name, instructor, class, test grades 1 through 5, average, low grade, high grade and new average with lowest grade dropped. I am so confused about arrays. I am using examples from class but I can't seem to get it to work. Anyone's help is appreciated. Here is what I have so far:
'****DIMENSION STATEMENTS****
DIM STU AS STRING
DIM CLASS AS STRING
DIM TEACH AS STRING
DIM GRADE (1 TO 5) AS INTEGER
DIM AVG AS SINGLE
DIM NEWAVG AS SINGLE
DIM LOW AS SINGLE
DIM HIGH AS SINGLE
'****PROGRAM****
GOSUB DATAENTRY:
GOSUB CALCGRADES:
GOSUB STUDENTREPORT:
END
'****SUB-ROUTINES****
DATAENTRY:
CLS
COLOR , 0
CLS
PRINT
COLOR 14
PRINT "********************************************************************************"
PRINT TAB(31); "DATA ENTRY SCREEN"
PRINT "********************************************************************************"
PRINT
PRINT TAB(8); "Please enter as you would like it to appear on student report"
PRINT
INPUT " ENTER INSTRUCTOR'S FULL NAME: ", TEACH$
INPUT " ENTER COURSE NAME: ", CLASS$
INPUT " ENTER STUDENT'S FULL NAME: ", STU$
INPUT " ENTER STUDENT'S TEST SCORE #1: ", GRADE(1)
INPUT " ENTER STUDENT'S TEST SCORE #2: ", GRADE(2)
INPUT " ENTER STUDENT'S TEST SCORE #3: ", GRADE(3)
INPUT " ENTER STUDENT'S TEST SCORE #4: ", GRADE(4)
INPUT " ENTER STUDENT'S TEST SCORE #5: ", GRADE(5)
RETURN
CALCGRADES:
HIGH = GRADE(G)
LOW = GRADE(G)
FOR GRADE = 1 TO 5
IF GRADE(G) > HIGH THEN
HIGH = GRADE(G)
END IF
IF GRADE(G) < LOW THEN
LOW = GRADE(G)
END IF
NEXT G
TOTAL = GRADE(1) + GRADE(2) + GRADE(3) + GRADE(4) + GRADE(5)
AVG = TOTAL / 5
NEWAVG = (TOTAL - LOW) / 4
RETURN
STUDENTREPORT:
CLS
COLOR , 6
CLS
PRINT
COLOR 15
H1$ = "Grade report for: "
H2$ = "Prepared on: "
H3$ = "Class Name: "
H4$ = "Instructor: "
H5$ = "-------------------------------------------"
H6$ = "Test 1: "
H7$ = "Test 2: "
H8$ = "Test 3: "
H9$ = "Test 4: "
H10$ = "Test 5: "
H11$ = "Average: "
H12$ = "Low Score: "
H13$ = "High Score: "
H14$ = "New Average with lowest test score dropped: "
PRINT TAB(22); H1$; STU
PRINT TAB(22); H2$; DATE$
PRINT TAB(20); H5$
PRINT
PRINT
PRINT
PRINT
PRINT TAB(10); H3$, CLASS$
PRINT TAB(10); H4$, TEACH$
PRINT
PRINT
PRINT TAB(10); H6$; GRADE(1)
PRINT TAB(10); H7$; GRADE(2)
PRINT TAB(10); H8$; GRADE(3)
PRINT TAB(10); H9$; GRADE(4)
PRINT TAB(10); H10$; GRADE(5)
PRINT TAB(10); "------------"
PRINT TAB(10); H11$; AVG
PRINT
PRINT TAB(10); H12$; LOW
PRINT TAB(10); H13$; HIGH
PRINT
PRINT TAB(10); H14$; NEWAVG
RETURN