Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

package studentWork; import com.opencsv.bean.CsvToBeanBuilder; import java.io.FileNotFoundException; import java.io.FileReader; public class H4_Q1 { public static void main(String[] args) { //Part a //modify line of code below

image text in transcribed

package studentWork; import com.opencsv.bean.CsvToBeanBuilder; import java.io.FileNotFoundException; import java.io.FileReader; public class H4_Q1 { public static void main(String[] args) { //Part a  //modify line of code below  int[] numbers; //Part b  double average = 0; double sum = 0; //Part c  int t; //holds value at index j when swapping occurs   //Part d  //Uncomment and add to the code below   /*  if((numbers.length % 2) == 0)  {  /umber of records is even  }  else {   }   */   } }
Question 1 In this question you will be asked to complete basic statistics on a specified array of integer values. A good reference for basic statistics formulas can be found at: http://integral-table.com/downloads/stats.pdf. a. In the class file H4_Q1, create an int array named numbers initialized with the following values: {2,6,9, 3, 12, 4, 14,4}. b. Add code to HA_Q1 that determines the sample mean of numbers and prints it to the screen with an appropriate label. c. Using the algorithm given below, write code in H4_Q1 to sort the array numbers in ascending order. Let n be the size of numbers. input: a non-sorted list of n numbers, Q1, Q2 ..., An output: a list with the same numbers, sorted in non-decreasing order for i: n to 1 for j: 1 to i - 1 if a; > a3+1 then { // swap a, with a;+1 ta; aj aj +1 +1 -t Figure 1: Sorting Algorithm d. In HAQI, write code to identify the median of the data in numbers Note that your code should work when the dataset contains an even or odd number of records. Write the result to the screen with an appropriate label

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

Graph Databases In Action

Authors: Dave Bechberger, Josh Perryman

1st Edition

1617296376, 978-1617296376

Students also viewed these Databases questions