time due | submission file |
---|---|
8:00 AM 1 December, 2004 | csci/201/HW5/breakdown.java |
Review the information in Homework 4 regarding problems with filenames and NetBeans I/O before working on this program.
Write a Java application called breakdown
that
reads lines of input from the Scanner
class
stdin
, set as shown in Homework 4.
Each line of input will contain a single integer.
The first line will specify the number of integers that follow.
You should use this number to create an array to hold all of the
remaining integers in the file.
After you have read in this array, you should compute the average of all the numbers of the array. Then your program should produce three lines of output. The first will print the average. The second will specify the number of integers that is less than the average; the third, the number exactly equal to the average; and the fourth, the number less than the average.
Suppose the input data set contains the following lines:
6 202 303 101 303 505 404
Then the file contains six data values. The average of the six is 303. Your program should print something like:
Average value: 303.00 Number values below average: 2 Number values equal to average: 2 Number values above to average: 2