Computer Science 331
Principles of Programming Languages
Programming Assignment #1
"Above Average"
due Wednesday, January 15, by 2 p.m.
This is a simple program to "warm you up" and to set up some basis for class discussion. You are to write a Java program that can take an arbitrary number integers as data and then tells how many of the integers are "above average", i.e. how many of the data are greater than the mean.
Your program should begin by reading the number of integers from the user (prompts are neither necessary nor desired). If this number is legal (i.e. is non-negative), then that many numbers should be read. If it is not, then an error message should be printed. A sample run is below. User inputs are underlined
4
1 2 3 4
The number of values > average is: 2
You are to write your program in Java. You may use any standard class you wish.
You are to print out a listing of your program, along with two sample runs - one that produces output similar to the above (though a more substantial example would be nice) and one that shows your error message in action. These are to be stapled together, along with a cover sheet, and are to be turned in to me by 2 p.m. on January 15.
BONUS
For a small amount of bonus credit, turn in a second version of the program. This version does not specify how many numbers are to be read; rather it reads as many as it gets on a single line. If you do write this program, make sure to turn in both versions.