Question

Please answer as soon as possible Consider the function doIt defined as follows: def doIt(numbers: Array[Double],...

Please answer as soon as possible

Consider the function doIt defined as follows:

def doIt(numbers: Array[Double], x: Double, y: Double) =
    numbers.filter( (number: Double) => number >= x - y && number <= x + y )

If numbers is:

numbers = Array(2.5, 1, 3.2, 9.3, 2, 9, 1.5)

What is returned by doIt(numbers, 2, 3)?

Homework Answers

Answer #1

It will return

2.5 1.0 3.2 2.0 1.5

because these numbers lies between range -1(=2-3) and 5 (=2+3)

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Please answer as soon as possible What's the contents of newNumbers after the following code is...
Please answer as soon as possible What's the contents of newNumbers after the following code is executed? val numbers = Array(2.5, 1, 3.2, 9.3, 2, 9, 1.5) val newNumbers = numbers.map(_.toInt)
1) Develop a C++ function that determines the average value of an array of type double...
1) Develop a C++ function that determines the average value of an array of type double elements double GetAverage(double array[], int size) The function should accept as input an array of double values The function should accept as input the number of elements in the array of double values The function should return a double value which is the array's average value 2) Develop a C++ function that determines the variance of an array of type double elements double GetVariance(double...
PLEASE, I NEED THE RIGHT ANSWER FOR THIS QUESTION AS SOON AS POSSIBLE PLEASE. (THE ANSWER...
PLEASE, I NEED THE RIGHT ANSWER FOR THIS QUESTION AS SOON AS POSSIBLE PLEASE. (THE ANSWER MUST BE NOT MORE THAN 2 TO 3 SENTENCES) THANK YOU IN ADVANCE!! what does a critical v/c ratio (X) of 0.9 mean for an intersection? (BE CLEAR AND SPECIFIC)
Please answer the following as soon as possible. Thank you. Add the top method in class...
Please answer the following as soon as possible. Thank you. Add the top method in class Stack to the following python code which returns the top item of the stack. Test it. Design top() method using a single queue as an instance variable, and only constant additional local memory within the method bodies. python code: class Stack: def __init__(self): self.q = Queue() def is_empty(self): return self.q.is_empty() def push(self, data): self.q.enqueue(data) def pop(self): for _ in range(self.q.get_size() - 1): dequeued =...
(1) Use ‘sample’ function to generate a vector of 100 random numbers that follows a multinomial...
(1) Use ‘sample’ function to generate a vector of 100 random numbers that follows a multinomial distribution with probability (0.1, 0.15, 0.3, 0.45). (2) Without using the ‘sample’ function, generate a vector of 100 random numbers that follows a multinomial distribution with probability (0.1, 0.15, 0.3, 0.45). (3) Calculate the probability for 2.5 < X < 9 in a Poisson distribution with the mean 6. (using R)
A table of values is given for a function f(x, y) defined on R = [1,...
A table of values is given for a function f(x, y) defined on R = [1, 3] × [0, 4]. 0 1 2 3 4 1.0 2 0 -3 -6 -5 1.5 3 1 -4 -5 -6 2.0 4 3 0 -5 -8 2.5 5 4 3 -1 -4 3.0 7 8 6 3 0 Estimate f(x, y) dA R using the Midpoint Rule with m = n = 2 and estimate the double integral with m = n =...
Please I need The right answer for this question as soon as possible. A sag vertical...
Please I need The right answer for this question as soon as possible. A sag vertical curve (equal tangent) has PVI at station 212+00 and elevation 540.75 ft. The initial grade is -2.5% and the final grade is +4.5%. The length of the curve is 900 ft. Determine the following, 1. Stationing of the low point, PVC, and PVT. 2. Elevation at station 213+00, PVC, low point, and PVT.
1. Let f be the function defined by f(x) = x 2 on the positive real...
1. Let f be the function defined by f(x) = x 2 on the positive real numbers. Find the equation of the line tangent to the graph of f at the point (3, 9). 2. Graph the reflection of the graph of f and the line tangent to the graph of f at the point (3, 9) about the line y = x. I really need help on number 2!!!! It's urgent!
CAN YOU PLEASE ANSWER AS SOON AS POSSIBLE AND PLEASE ANSWER ALL QUESTIONS THANK YOU 1/...
CAN YOU PLEASE ANSWER AS SOON AS POSSIBLE AND PLEASE ANSWER ALL QUESTIONS THANK YOU 1/ Create a short paragraph using the following terms: sound, pinna, auditory canal, tympanic membrane, ossicles, middle ear, oval window. 2/ Why cone receptors are able to send information about different frequencies of light? 3/In your own words, explain one way in which neuroplasticity allows learning and memory to occur 4/ Sleep is a behavioral state and play a key role in cognition. So how...
Please answer as soon as possible. No explanation needed. 1. Multiple Choice Perform the XOR Operation...
Please answer as soon as possible. No explanation needed. 1. Multiple Choice Perform the XOR Operation on inputs 1 and 1. This is 1 XOR 1. What is the output of this operation? 1 0 2 5 2. Multiple Choice. Fill in the blank part. Digital signatures use blank for the purposes of verifying message integrity. PGP Valid Certificate AES Encryption Hash Function 3. True/False A One Time Pad Ciphertext includes a key stream with a random number generator. True...