Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

( a ) Remove rows where at least a given fraction f of the values are negative ( b ) Replace negatives in

(a) Remove rows where at least a given fraction "f" of the values are negative
(b) Replace negatives in each of the remaining rows with average value of non-negative (greater than
or equal to 0) numbers in the same column; if there are no non-negative values in the column,
replace it with 0.
As an example, if we are given the following 2D array (56) :
-1,4,3,2,-3,2
-2,3,5,-4,0,1
-1,-3,-4,1,-1,0
-1,2,-3,6,5,3
-3,2,-3,-5,0,0
Step (a) will produce the following if the given fraction f=12 :
-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.
image text in transcribed

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

Modern Database Management

Authors: Heikki Topi, Jeffrey A Hoffer, Ramesh Venkataraman

13th Edition

0134773659, 978-0134773650

More Books

Students also viewed these Databases questions

Question

=+can you write alternative statements that are better?

Answered: 1 week ago