Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete the extractinfo method below (do not change the provided signature), which receives a String as a parameter, corresponding to a file name. The method

image text in transcribed
Complete the extractinfo method below (do not change the provided signature), which receives a String as a parameter, corresponding to a file name. The method must open that file, extract the required information (described below) from each line and output it to the console (using System.out...). You can safely assume that each line of the input file will start with 3 words, followed by at least 5 integer numbers. All the different numbers and words on a line are always separated by a single blank space. For each line of the input file, your method must: extract the first and third words, and find the shorter of the two (in case of a tie, the first word is kept) - extract the first, third, and fifth numbers and sum them up - print to the console those 2 tokens on the same line (shorter word and sum of odd numbers), separated by a blank space For example, if the input file contains this information: Because no matter 50 5 17 6 54 what you say 100 15 60 1 32 in life the 2 5 7 20 35 truth will always -22 -11 -8 2 400 be the truth -7 88 5 22 16 Quote from JCVD 25 -25 77 109 8 The output to the console will be: matter 121 say 192 in 44 truth 370 be 14 JCVD 110 pablte static void extractintersting FileName}

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

More Books

Students also viewed these Databases questions