Question: java please please solve everthing for credit ;) perign a Java class with a main method that fesds, tor a number of books, bie length
perign a Java class with a main method that fesds, tor a number of books, bie length of the ino. sample data to be read int Explanabion: there are threet books, the first with a longest sentence of ao and a chortert of 10a second book with longest sentence of 18 and shortest of 8 ; and a third book with longest sentence of 14 and sthertest of 2 . main will invoke methode, that you wtite, to perform the following tasks: (a) main will pass a filename (for input) and arry to a method rendtana that will reas frem that flle the book data flongest/shortest length). The mathod cemputes the average length of the tios sentences and stores it in the array that was passed to the method. The method will return the total number of books resd in. For example, given the above data, after readnata is finiahed enecueing, the array will contalin: \begin{tabular}{|l|l|l|} \hline 15,6 & 17,5 & 15.0 \\ \hline \end{tabular} and it will return 3 (b) main will invoke a methed susmarine that accepts an object of a class that wil enable writing to a file (such as, for example PrintWriter or Prinistresm or whichever you peefer), for output, an array (of average sentence lengths) and the cumber of elements in the array. The method first computes the overall average sentence length of all bocks and pints it to the output file. It then compares the overall average sentence longth to the average sentence longth of each book and writes to the file the number of sentenobs whose length are more than the average. less than the average and equal to the average length. The method will return the overal? average sentence length. For example, given the above data, after compare finishes exociting, the file should comtain: The ovara11. avarags in 11.5. 1 arerage was graater, than tha orerald averege 1 averagn wan eqoal to the eraral1 average 1 averogo was 1 ese then the overal1 wrerage (c) main will invoke a methed detaile that is passed the same object for printing to a file and array as in part (b) as well as the cverell average sentence length and will write for each book: the average length of the two sentences and whether the average sentence length for that book. is greater than, less than or equal to the overalf average length After executing this method, the fie contalis (output is cumulative from the previous ster den't close the output file until all output has been written) the avera11 arerage is 11.5 1 average wa greater, than the onaral1 average 1 ararage was equal to the everalt average 1 average was leas than the overal1 avarage 15. 9 is greater than the overal1 average 11,5 in equal to the everall average B. 0 in leas than the owerall average
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
