Assignment #6

due Monday, April 27

To submit the assignment save the program with the usual filename. Send me an email with the Turing file as an attachment.

Write a program that asks the user for the number of values they would like to use. Force the user to give a number between 5 and 20 (inclusive). Read that many numbers into an array declared as:

var nums : array 1 .. 20 of int.

It doesn't matter that some of the elements in the array may not be used. After reading all the values, find and print the mean (average) of all the numbers in the array.

Print all the elements in the array on 1 line with a space between each number. Any numbers less than the mean should be printed in red and any greater than the mean should be in green. If any happen to be equal to the mean print the number in black.

Print the largest and smallest values in the array in blue.

Here is a sample run of the program:

Marking Scheme

____
 18
asks & verifies intial input               (3) _____
reads elements of array                    (3) _____
finds mean                                 (3) _____
prints elements of array in correct colour (3) _____
prints largest and smallest in colour      (3) _____
comments and indentation                   (3) _____