Description
Objectives:
1) Learn to use arrays
2) Learn to use while and for loops
3) Learn to use if/else statements
Description
In this programming assignment you will write a program that will read a variable
number of real numbers. The program will then compute the mean (or average),
minimum, and maximum of the numbers entered.
1. The program will ask for the user to enter numbers. Entry of the numbers will
end when 20 numbers have been entered, or when the user inputs ‘q’ (or any other
non-numeric character). Any numbers beyond the maximum of 20 will be
ignored.
2. The program will then print the (up to 20) numbers that were entered.
3. Finally, the program will compute the average, maximum, and minimum of the
numbers entered and print out the resulting statistics. An example session is
shown below.
4. If no valid numbers are entered, you should print out an error message to that
effect.
Deliverables:
1) Submit the C source code as an attachment to the TA Fernando Cervantes:
fcervantes@miners.utep.edu. Name your program firstinitiallastname_aver.c.
Thus, if President Barak Obama were taking this class he would name his file
“bobama_aver.c”.
2) The subject line must be “EE 2372 Assignment 3” (don’t include the quotes).
$ ./a.out
Enter real numbers, up to 20, q to quit
10 37 15 21 18 q
You entered the following values:
10.0 37.0 15.0 21.0 18.0
The values have mean 20.2, max 37.0, and min 10.0
$ ./a.out
Enter real numbers, up to 20, q to quit
q
No valid numbers entered
$ ./a.out
Enter real numbers, up to 20, q to quit
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
You entered the following values:
1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0
14.0 15.0 16.0 17.0 18.0 19.0 20.0
The values have mean 10.5, max 20.0, and min 1.0
Scoring:
Your grade for this assignment will be determined by three criteria. The first criterion
determines if your program compiles and runs producing the correct result. The correct
result must adhere to what is specified in the Tasks section. The second criterion is
whether the program follows the interface specification outlined in the Tasks section.
The third criterion determines if your source code is well documented. Your source code
must include (at the top) your name, class section, due date, assigned date, and a small
description of your program. For this assignment, each line of code should have a
descriptive comment.
Operation/Successful Demonstration 60%
Was a C source file submitted? 10%
Does the program compile on Linux? 15%
Does the program run correctly on Linux? 35%
Adherence to Interface Specification 30%
Does the program adhere to the interface specification
in the tasks section? 30%
Comments 10%
Is the source code well-documented? 10%
Lateness 10% per day (including
weekends and holidays)