Program to read ages into array as long as values are greater than sentinal value. (note that in contrast to class, reals rather than integers are used for the data. Also the array can hold up to 500 values, not just 20. This program is probably slightly more elegant than the one written on the fly in class, but that's a matter of taste. program inout; type ara500 = array[1..500] of real; var ages: ara500; sentinel, age: real; i, n: integer; begin sentinel := 0.0; n := 0; writeln('Enter age or 0.0 to quit.'); readln(age); while age > sentinel do begin n := n + 1; ages[n] := age; writeln('Enter age or 0.0 to quit.'); readln(age); end; writeln(n, ' ages entered.'); i := 0; while i > n do begin {alternate code} i := i + 1; age := ages[i]; { <- omit } writeln(age:5:1); writeln(ages[i]:5:1); end; readln; end. Sample output: >Enter age or 0.0 to quit. <2.0 >Enter age or 0.0 to quit. <28.0 >Enter age or 0.0 to quit. <11.5 >Enter age or 0.0 to quit. <17.0 >Enter age or 0.0 to quit. <0.0 >4 ages entered. > 2.0 > 28.0 > 11.5 > 17.0 Previous program with the following additions: 1. Find the maximum and minimum age. 2. Count the number of people older than 65. 3. Adds together the total years in excess of 65. It also goes through the array in reverse order (larger subscript to smaller) and thus lists the ages in revers order program inout; type ara500 = array[1..500] of real; var ages: ara500; sentinel, age, max, min, excess: real; i, n, older: integer; begin sentinel := 0.0; n := 0; writeln('Enter age or 0.0 to quit.'); readln(age); while age > sentinel do begin n := n + 1; ages[n] := age; writeln('Enter age or 0.0 to quit.'); readln(age); end; writeln(n, ' ages entered.'); i := n; max := ages[1]; min := ages[1]; older := 0; excess := 0.0; while i > 0 do {Alternate code} begin age := ages[i]; { <- omit} writeln(age:5:1); writeln(ages[i]:5:1); if age > max then if ages[i] > max then begin max := age; max := ages[i]; end; if age < min then if ages[i] < min then begin min := age; min := ages[i]; end; if age > 65.0 then if ages[i] > 65.0 then begin older := older + 1; excess := excess + age - 65.0; excess := excess+ages[i]-65.0; end; i := i - 1; end; writeln('Max =', max:5:1, ' Min =', min:5:1); writeln('Number older than 65 =', older:5); writeln('Total years in excess of 65 =', excess:5:1); readln; end. Sample output: >Enter age or 0.0 to quit. <77.5 >Enter age or 0.0 to quit. <88.0 >Enter age or 0.0 to quit. <61.5 >Enter age or 0.0 to quit. <28.0 >Enter age or 0.0 to quit. <67.0 >Enter age or 0.0 to quit. <0.0 >5 ages entered. > 67.0 > 28.0 > 61.5 <- note reversed ordeer > 88.0 > 77.5 >Max = 88.0 Min = 28.0 >Number older than 65 = 3 >Total years in excess of 65 = 37.5 Previous program with the following additions: 1. Find the maximum and minimum age. 2. Count the number of people older than 65. 3. Adds together the total years in excess of 65. It also goes through the array in reverse order (larger subscript