Write a program to prompt a user for the number of integers and the
integers (at least 5, ranging from 0 to 100) and print the minimum, maximum,
total sum, and average of the numbers.
The program interface is as follows:
How many integers? 6
Next integer? 100
Next integer? 97
Next integer? 68
Next integer? 85
Next integer? 88
Next integer? 76
 Write a static method named numberStatistics that accepts a string of
text as a parameter. Assume that the text is read from a file, "score.txt."
The text is a series of strings (name) and integers (score). The method should
process this text (maybe multiple lines) and report various statistics about the
integers. Report the total number of the numbers, the sum of the numbers,
the average of the numbers and the minimum and maximum numbers. For
example, if the text is the following:
Helene 5 Jordan 7 Eve 2 Ken 8 Andrew 9
David 10 Amy 12 Sean 98 Patrick 7
Joy 14 Sue 20 Jimmy 22
Your method should produce the following output.
Sum of numbers
 Write a static method named negativeSum() that accepts a string of text
as a parameter from the standard console input stream. Assume that the text
is a series of integers, and determine whether or not the cumulative sum
starting from the first number is ever negative. The method should produce a
message indicating whether or not a negative sum is possible and it should
return true if a negative sum can be reached and false if it can't be
reached. For example, if the string contains the following text,
"38 4 19 -27 -15 -3 4 19 38"
your method will consider the sum of just one number (38), the sum of the
first two numbers (38 + 4), the sum of the first three numbers (38 + 4
+ 19), and so on up to the sum of all of the numbers. None of these
sums is negative, so the method would produce the following message:
no negative sum
and would return false. If the text is the following,
"14 7 -10 9 -18 -10 17 42 98"
the method finds that a negative sum is reached after adding 6 numbers together
(14 + 7 + -10 + 9 + -18 + -10) and that the sum is -8. It should
report the following:
-8 after 6 steps
and should return true, indicating that a negative sum can be reached.
O Line and Token Processing from File
 Write a static method name wordCountAndFixSpace that takes
a Scanner representing a file as a parameter and that reports various
statistics about the file. The method should generate the number of lines, the
total number of words (regard "can't" as 1-word and disregard any marks
or signs such as ?, ", ., -, \n, \t, etc. when counting), the total
number of characters, and the longest word. The text may contain multiple
spaces and tabs. Those spaces should be reduced to single spaces between
each word in order to print them to the console. Your program can assume
that the text file may contain at least one line of input.
The input file contains the following text:
faster with practice.
If you were going to run a marathon a year from now,
you wait for
months and then run 26 miles cold?
No, you would build up slowly, running most days.
You might start on the
flats and work up to more
demanding and difficult terrain. To become a writer, write.
for that book manuscript or that monster
on your writing.
Purchase answer to see full