maxWord
Category: Line-Based File Processing
Author: Benson Limketkai
Book Chapter: 5.3
Problem: maxWord
Write a static method maxWord that accepts a Scanner for an input file. Each line of input has a word followed by some positive numbers. The method should return the word with the maximum sum of numbers. You may assume that the input file is properly formatted and has at least one line. For example, given the following input file: cse142 176 148 561 rocks 937 889 computer 654 27878 science 583 4life 864 747 For a Scanner variable named input referring to the file above, the call of maxWord(input) would return computer, since it is followed by numbers whose sum is 28,532 (654 + 27878), which is more than any of the other sums.