Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Intro to Java help?) Write a static method named boyGirl that takes a string of text as a parameter. Assume that the text represents a

(Intro to Java help?)

Write a static method named boyGirl that takes a string of text as a parameter. Assume that the text represents a series of names followed by integers, and that the names alternate between boys' names and girls names. Your method should compute the sum of the boys' integers and the sum of the girls' integers separately and print them. The line could end with either a boy or girl; you may not assume that it contains an even number of names. For example, if the String contains the following text,

"JP 3 Helene 7 Jordan 14 Iva 13 Sergey 4 Marianne 9 Kenneth 6"

then your method should produce the following output:

4 boys, 3 girls

Boys sum = 26

Girls sum = 29

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

Students also viewed these Databases questions

Question

5. Identify three characteristics of the dialectical approach.

Answered: 1 week ago

Question

7. Identify six intercultural communication dialectics.

Answered: 1 week ago