Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Show Header O BJP3 Exercise 6.1: boyGirl Favorite Language/Type: 4 Java file processing Scanner Author: Jason Ganzhorn (on 2013/04/01) Write a method named boyGirl that

image text in transcribed

Show Header O BJP3 Exercise 6.1: boyGirl Favorite Language/Type: 4 Java file processing Scanner Author: Jason Ganzhorn (on 2013/04/01) Write a method named boyGirl that accepts a Scanner as a parameter. The Scanner 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. If the input file tas.txt contains the following text: Steve 3 Sylvia 7 Craig 14 Lisa 13 Brian 4 Charlotte 9 Jordan 6 then your method could be called in the following way Scanner input - new Scanner(new File("tas.txt")); boyGirl(input); and should produce the following output, since the boys' sum is 27 and the girls' sum is 29: 4 boys, 3 girls Difference between boys' and girls' sums: 2 Type your solution here: 1

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_2

Step: 3

blur-text-image_3

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

Guide To Client Server Databases

Authors: Joe Salemi

2nd Edition

1562763105, 978-1562763107

More Books

Students also viewed these Databases questions

Question

1. Explain the 2nd world war. 2. Who is the father of history?

Answered: 1 week ago

Question

What is the growth rate of GDP per capita?

Answered: 1 week ago