Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Discuss the Hawthorne experiments in detail

Answered: 1 week ago

Question

Explain the characteristics of a good system of control

Answered: 1 week ago

Question

State the importance of control

Answered: 1 week ago

Question

What are the functions of top management?

Answered: 1 week ago