Print Number Summary
Let's print some fun statistics about some numbers!
Write a method named
processNumbers that accepts a single
String as input.
String will contain, on separate lines, integer values.
However, some lines may be blank, and other integers may have whitespace before or after.
Here's an example:
1 2 4
String line by line, using
Integer.parseInt to convert each line to an
Print a report when you are done in the following format, in this case using the numbers shown above:
Count: 3 Sum: 7 Count Even: 2 Count Odd: 1 Average: 2.3
Note that you should format the average with a single decimal place.
You should examine how to use the
Math.round method and a bit of cleverness to accomplish this.