Problem

Write a method called boyGirl that accepts a Scanner that is reading its input from a file...

Write a method called boyGirl that accepts a Scanner that is reading its input from a file containing a series of names followed by integers. The names alternate between boys’ names and girls’ names. Your method should compute the absolute difference between the sum of the boys’ integers and the sum of the girls’ integers. The input could end with either a boy or girl; you may not assume that it contains an even number of names. For example, if the input file contains the following text:

Erik 3 Rita 7 Tanner 14 Jillyn 13 Curtis 4 Stefanie 12 Ben 6

Then the method should produce the following console output, since the boys’ sum is 27 and the girls’ sum is 32:

4 boys, 3 girlsDifference between boys' and girls' sums: 5

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 6
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT