Question: (5) File Manipulation : (10 points) Write a void method named boyGirl that accepts a Scanner as a parameter. The Scanner is reading its input

 (5) File Manipulation : (10 points) Write a void method named

(5) File Manipulation : (10 points) Write a void 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 t boys' integers and the sum of the girls' int not assume that it contains an even number of names. If the input file tas.txt contains the following text: egers. The input could end with either a boy or girl; you may Steve 3 Sylvia 7 Craig 14 > Lisa 13 Brian Charlotte 9 Jordan 6 then the main method could be called in the following way: public static void main(Stringl] arg)f 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: Your file contains: 4 boys and 3 girls The difference between boys' and girls' sums: 2 Notes: The file always starts with a boy, but it may or may not end with a girl. The file may be different than the one above, do not assume it is 7 people

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!