Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA - Please read the instructions in the image. All I know is each new line has a header value telling you how many numbers

JAVA - Please read the instructions in the image.
All I know is each new line has a header value telling you how many numbers are on each line on the file you are reading from.
I was having difficulty know how to read in each integer on each line to find the sum then average of that line. Then moving on to the next line.
Is there a way to grab one line at a time and read each individual integer on one line, then total and average that line, the go to the next line and do the same?
Its a basic Iava class so nothing fancy can be written.
Thanks!
image text in transcribed
ab 1.2 (Lab 9-5 in the 1115 labs)--Calculating Averages (Averages) The file nambers text conisits of sequences of numbers, each sequence preceded by a header valee nd then followed by that many integers Read in the sequences and print their averages When all sequences have been read m, print oute number of sequences processed ample Test Ra For example if the file nusbers,text. contains 12 1440 the program should produce the following outpu The averege of the 5 ietegers 12 24 6 60 17.2 The avexage of the 1 lategers 17 18 37. the average of the 2 inceger 90 80 n 95. .Ths data in this example as of a somewhat move coeoples structuce-both oof and heades value processing is requited (the formier so determine when theve are no more sequences, and the latter to process each sequence)

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

Students also viewed these Databases questions