Assignment 5: Computing Averages

Write a program that computes the average of numbers. Specifically, the program should use a FOR loop, a REPEAT loop, and a WHILE loop to find the sum of numbers entered by the user, and then compute the average of those numbers. The program is due Monday, Oct. 30.

Your program must include the following

Constants instead of actual data values
Nowhere inside the program should you use raw data values. Instead, define appropriate constants in the declaration part of your program and use those in the program.
Procedure ShowTheMenu
This procedure should display a menu with the choices
      [a]  To compute average using FOR loop
      [b]  To compute average using REPEAT loop
      [c]  To compute average using WHILE loop

      [x]  To eXit the program

Note that the actual letters 'a', 'b','c', and 'x' should not appear in a WRITELN statement. You should instead use the appropriate constants.

Procedure HandleTheMenu
This procedure must use the CASE statement to handle the menu choices for the user input. The procedure should take one input parameter of type character, containing the key entered by the user. The program should be able to handle capital as well as small letter if they correspond to a valid menu choice.
Procedures FindSumUsingFor, FindSumUsingRepeat, FindSumUsingWhile
Each of these procedures must have one input parameter of type integer and one output parameter of type real. The input parameter corresponds to the number of items to sum. The respective loop inside each procedure is to ask the user to enter the numbers and computes their sum. The output parameter corresponds to the sum of the numbers that the user entered.
Function ComputeAverage
This function is supposed to take two parameters: a real type corresponding to the sum of the numbere entered by the user, and an integer type corresponding to the number of items entered by the user. The function is to compute the average.

Please post any questions on the bulletin board, or send me electronic mail.

(bgw)