```PROGRAM SuperTutor;

{Programmer:	Gregory A. Perkins
CS 65
DUE:			20 Sep 96}

{This program accepts two numbers from the tutored student, adds the two numbers, accepts
what the student feels the answer is and tells the student if he/she is right or wrong.
In addition, the program allows the student to do all this 5 times, and if the student
fails to get the right answer on the first attempt of a problem, the program allows the
student to try again before displaying the correct answer.  Finally, the program displays
the number of problems attempted and gives the student a progress report.}

{Variables declaration section}
VAR FirstNum, SecondNum, Sum, Answer, Count: INTEGER;
VAR FirstCorrect, SecondCorrect, Wrong: INTEGER; {Variables for display of performance report}
CONST Loop = 5;{Constant used to control the number of loop executions}

BEGIN
{Initialize performance report variables to zero}
FirstCorrect := 0;
SecondCorrect := 0;
Wrong := 0;

{Introduction}
WRITELN('Hello!  Welcome to the Super Tutor!!!');
WRITELN;
WRITELN('I will ask you to enter a set of two numbers, then I');
WRITELN('will ask you to enter the result of adding the two numbers.');
WRITELN('incorrect.  If the answer was incorrect, I will give you');
WRITELN('a second chance before I tell you the correct answer.');
WRITELN;
WRITELN('We will do five problems together.  Then I will tell you');
WRITELN('how you did overall.  Good Luck!!!');
WRITELN;
WRITELN('Hit the ENTER key when you are ready to continue...');
READLN;{Pause and wait for user to hit a key}

FOR Count := 1 TO Loop DO{Execute the program a total of 5 times}

BEGIN

WRITELN;{Blank line provided for formatting of subsequent loops}

{Display the problem number, so student is aware of progress}
WRITELN('Problem number: ', Count:1);

{Prompt user for two numbers to be added and store their values}
WRITELN('Enter the first number, then enter the second.');

{Determine what the correct answer to the problem is}
Sum := FirstNum + SecondNum;

{Prompt user for the answer and store the value}

{Test to see if the user got the correct answer}
BEGIN
WRITELN('Congratulations!  You got the right answer!');
FirstCorrect := FirstCorrect + 1;{Update performance variable for report}
END;

BEGIN

{Inform user that he/she has made an error}
WRITELN('Oops!  You made a mistake.  Can you find it?');

{Give the user another opportunity to get the correct answer}

{Prompt user for the answer again and store the value}

{Test to see if the user got the correct answer the second time}
BEGIN
WRITELN('Congratulations!  You got the right answer!');
SecondCorrect := SecondCorrect + 1;{Update performance variable for report}
END;

BEGIN
WRITELN('I''m sorry, but the correct answer is: ', Sum:5);
Wrong := Wrong + 1;{Update performance variable for report}
END;

END;{Finish second chance loop}

{Display of progress report}
WRITELN('Hit the ENTER key to see your performance report...');
READLN;{Wait for user to hit the ENTER key}

{Display the number of problems attempted}