Question: CS 114 Spring 2020 Lab Assignment 1 Working with 2D arrays in Java In this assignment, you will be manipulating a 2D array as follows:
CS 114 Spring 2020 Lab Assignment 1 Working with 2D arrays in Java In this assignment, you will be manipulating a 2D array as follows: (a) Remove rows where half or more values are negative (b) Replace negatives in each of the remaining rows with average value of the positive numbers in the same column; if there are no positives in the column, replace it with 0. As an example, if we are given the following 2D array(5 x 6) : -1, 4, 3, 2, -3, 2 -2, 3, 5, -4, 0, 1 -1, -3,-4, 1,-1, O -1, 2, -3, 6, 5, 3 -3, 2, -3, -5, 0, 0 Step (a) will produce the following: -1, 4, 3, 2, -3, 2 -2, 3, 5, -4, 0, 1 -1, 2, -3, 6, 5, 3 Step (b) will produce the following: 0, 4, 3, 2, 2.5, 2 0, 3, 5, 4, 0, 1 0, 2, 4, 6, 5, 3 You are given a starter Java file where you need to complete the code in the 2 functions extract() and replace() which correspond to the 2 steps (a) and (b). You are encouraged to test with other examples
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
