Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java please (8b) please ignore 8A (i don't need it) only 8b and 8c explaining what action(s) each performs. Sample data to be read in:

java please (8b)
please ignore 8A (i don't need it)
only 8b and 8c
image text in transcribed
explaining what action(s) each performs. Sample data to be read in: Explanation: there are three books, the first with a longest sentence of 20 and a shortest of 10 ; second book with longest sentence of 18 and shortest of 5 ; and a third book with longest sentence of 14 and shortest of 2 . main will invoke methods, that you write, to perform the following tasks: (a) main will pass a filename (for input) and array to a method readData that will read from the file the book data (longest/shortest length). The method computes the average length of the two sentences and stores it in the array that was passed to the method. The method will return the total number of books read in. For example, given the above data, after readData is finished executing, the array will contain: \begin{tabular}{|l|l|l|} \hline 15.0 & 11.5 & 8.0 \\ \hline \end{tabular} and it will return 3 (b) main will invoke a method summarize that accepts an object of a class that will enable writing to a file (such as, for example PrintWriter or PrintStream or whichever you prefer), for output, an array (of average sentence lengths) and the number of elements in the array. The method first computes the overall average sentence length of all books and prints it to the output file. It then compares the overall average sentence length to the average sentence length each book and writes to the file the number of sentences whose length are more than the averag less than the average and equal to the average length. The method will return the overall average sentence length. For example, given the above data, after compare finishes executing, the file should contain: The overal1 average is 11.5 1 average was greater than the overall average 1 average was equal to the overall average 1 average was less than the overall average

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

More Books

Students also viewed these Databases questions