Classic Computer Magazine Archive COMPUTE! ISSUE 54 / NOVEMBER 1984 / PAGE 157


C. Regena

Algebra Tutorial

Part 2

Last month's column introduced "Algebra Tutorial," an educational program for students learning higher math. Part 2 presents the rest of the program listing and line-by-line explanation.

You'll recall that "Algebra Tutorial" is intended for students who already have some knowledge of algebra. It assumes the student is familiar with terms usually introduced before binomial multiplication. (A binomial is a numeric expression of two terms.) Basically, the tutorial covers the multiplication of one binomial by another—such as (x + 5) times (x+4).

Last month's column included the program listing for lines 110 through 1300. Briefly, these lines redefine a few characters into special algebraic symbols (160–170); print a screen showing a comparison of binomial multiplication and numeric multiplication problems (190–300); display the general form of the multiplication problem and its answer (310–460); present a problem to the student (470–950); print a screen showing numeric coefficients for the first term (960–1110); present a problem to the student involving numeric coefficients (1120–1180 and the subroutine starting at 1960); and display a screen of information about using positive and negative numbers (1190–1300).

Picking up where we left off, lines 1310–1320 (and the subroutine at 1880) give the student a problem which may contain positive and negative numbers and coefficients in the first term. Lines 1330–1520 are two more screens of final information.

Helping Where It Is Needed

One advantage a computer tutorial has over a textbook is that a student can work at his or her own pace, yet get immediate feedback. Random numbers make the problems different each time so the student doesn't just memorize a sequence. If the student has trouble with one section, the computer can repeat the section many times. On the other hand, if the student knows the subject, the computer can keep track of the progress and advance accordingly.

Each time the student works on a problem, a flag F is set to zero. The student presses a key at each prompt. If the key pressed is incorrect, there is a low "uh-oh" sound, the flag F is set to 1, and the student must try again. For the numbers, the program won't continue until the correct numbers are pressed. On the + or - signs, however, the correct sign is printed and the program continues. If the problem is completed without any errors, the student has the option to try another problem or to continue the program. If an error has occurred, the flag F will be 1, and the student will be given another problem.

The program from line 1530 to the end contains subroutines which are used in several places. Lines 1530–1570 are the subroutine that checks if the ENTER key has been pressed. Lines 1580–1610 are the subroutine for an incorrect response—the computer plays an "uh-oh" sound and F is set to 1.

Lines 1620–1680 play a prompting beep, blink a question mark while waiting for the student to press a key, then print the key pressed.

The prompting is always done on the twenty-third row, or the row just printed. The column C is specified before the subroutine is called. Lines 1690–1730 play an arpeggio after the problem has been completed.

Lines 1740–1870 contain the subroutine to get an answer. P$ is the string value of the correct answer. The numbers may be one or two digits, so this subroutine also determines the number of digits in the answer and where to place the prompting positions. CC and C are variables used for determining the columns.

Presenting Problems

Lines 1880–2690 are the subroutine to present a problem to the student. The first type of problem (T = l) is for positive numbers only, and the subroutine is entered at line 1960. For the second type of problem (T = 2), the subroutine is entered at line 1880. SD and SE are the signs for the second terms, D and E. SD$ and SE$ are the corresponding symbols. For the first type of problem, SD and SE are 1, but for the second type they may be 1 or —1.

Lines 1970–2020 choose the coefficients of the first terms, A and B, and the constants D and E for the second terms. Lines 2010–2020 make sure there will be a middle term in the multiplication. F is the flag for error checking. A$ and B$ are the string values of A and B, which are necessary for ease in printing. X$ is the variable in the binomials, which may be X, Y, or Z.

Lines 2070–2110 print the problem. Lines 2120–2600 print sections of the problem and get the student's answers. For each answer SS is the sign (plus or minus), C or CC is the column for the prompt and answer, and P$ is the correct answer. SGN is a function used to determine the sign. SGN returns 1 for a positive number, 0 for zero, and —1 for a negative number.

Lines 2700–2840 are the subroutine to get the student's answer for the + or - sign. When a sign needs to be chosen, a plus, minus, and question mark blink in position while waiting for the student's answer. The student must press the plus or the minus sign. If the answer is incorrect, a low "uh-oh" sounds, then the correct sign is printed. Both symbols are shifted. The student should use the LEFT SHIFT key to type these symbols to avoid an accidental FCTN + (QUIT). If you prefer to let the student press only the keys without SHIFT, change lines 2770 and 2810.

Customizing The Tutorial

Using the ideas in this program, you can design more subroutines to cover positive and negative first terms, alphabetic coefficients, alphabetic characters in the second terms, multiplying polynomials, factoring, etc.