Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Sum of farm:0 is :623.0 Sum of farm:1 is :709.0 Sum of farm:2 is :644.0 Sum of farm:3 is :622.0 Sum of farm:4 is :745.0

image text in transcribed

Sum of farm:0 is :623.0

Sum of farm:1 is :709.0

Sum of farm:2 is :644.0

Sum of farm:3 is :622.0

Sum of farm:4 is :745.0

The sum of the farm should also be part of the sample output

Please use java to answer the questions

will have to compute some values for these data. Assignment: The input file, input.txt, contains monthly pecan production data for some pecan farms. Each column represents a month, starting from January. The values in the column are comma separated. Each line or row represents a farm. Read the file and place the values in a 2D array of integers called data. Complete the following tasks by computing the necessary information. Use the given method header for each task. Call these methods from the main method with the data array. 1. Average pecan production per farm: Compute the average production for each firm. public static void farm_avg(int [] [] data) \{ 2. Average pecan production per month: Compute the average production for each month. public static void month_avg(int[][] data) \{ 3. Top three farm with the highest pecan production: Display the farm index and the total production of that farm. public static void top_farms (int[][] data) \{ 4. Top three months with the highest pecan production: Display the index of the month and the production amount. public static void top_months (int [] [] data) \{ Your program should use a try-catch block properly to handle file reading. Sample input: 15,50,62,72,73,74,80,55,46,43,34,1958,60,70,73,76,82,87,65,51,42,26,1943,59,65,72,82,65,64,53,51,41,27,2218,42,63,69,73,85,84,65,44,38,27,1419,46,50,77,82,95,98,93,84,74,17,10 Sample output: Average production for farm 0 is: 51 Average production for farm 1 is: 59 Average production for farm 2 is: 53 Average production for farm 3 is: 51 Average production for farm 4 is: 62 Average production for month 0 is: 30 Average production for month 1 is: 51 Average production for month 2 is: 62 Average production for month 3 is: 72 Average production for month 4 is: 77 Average production for month 5 is: 80 Average production for month 6 is: 82 Average production for month 7 is: 66 Average production for month 8 is: 55 Average production for month 9 is: 47 Average production for month 10 is: 26 Average production for month 11 is: 16 Farm with the highest production: 4 with production: 745 Farm with the second highest production: 1 with production: 709 Farm with the third highest production: 2 with production: 644 Month with the highest production: 6 with production: 413 Month with the second highest production: 5 with production: 401 Month with the second highest production: 4 with production: 386

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

Database Processing

Authors: David Kroenke

11th Edition

0132302675, 9780132302678

More Books

Students also viewed these Databases questions

Question

Appreciate why financial institutions are regulated. AppendixLO1

Answered: 1 week ago

Question

Explain the importance of prioritizing training and HRD needs

Answered: 1 week ago