Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can someone help me the code of following: Language: Java (please use the above picture as the starting java class) Ibackage studentwork; 00vw NP Eimport
Can someone help me the code of following:
Language: Java (please use the above picture as the starting java class)
Ibackage studentwork; 00vw NP Eimport ... public class H4_Q1 { 9 10 11 o public static void main(String[] args) { 12 13 14 //Part a //modify line of code below int[] numbers; 15 16 17 18 //Part b double average = 0; double sum = 0; 19 20 21 22 //Part 0 int t; //holds value at index j when swapping occurs 23 24 25 26 27 28 //Part d //Uncomment and add to the code below 29 30 31 32 if((numbers. length % 2) == 0) 33 34 /umber of records is even 35 36 else { 37 38 39 40 * 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 H4_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, 21, 22 ..., 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; > Aj+1 then { // swap a; with a;+1 taj ajaj+1 aj+1 +t Figure 1: Sorting Algorithm d. In H4_Q1, 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 labelStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started