Question: (Intro to Java help?) Write a static method named evenNumbers that accepts a string of text as a parameter. Assume that the text is a
(Intro to Java help?)
Write a static method named evenNumbers that accepts a string of text as a parameter. Assume that the text is a series of integers, and process this text and report various statistics about the integers. Report the total number of numbers, the sum of the numbers, the total count of even numbers and the percent of even numbers. For example, if the string is the following:
"5 7 2 8 9 10 12 98 7 14 20 22"
Your method should produce the following output.
Total numbers = 12
Sum of numbers = 214
Total evens = 8
Percent evens = 66.66666666666667
If a non-integer element is encountered, it should be ignored & not cause the program to crash. For example: "5 7 2 8 9 10 oops 12 98 7 14 20 22" will product output identical to the original example above.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
