Respuesta :
The program that returns all values between a and b inclusive in the partially filled array values is illustrated below.
What is a program?
A computer program means a sequence or set of instructions that is in a programming language for a computer to execute.
Here, the program based on the information given will be:
count = 0
for each v in values
if a <= v <= b
count++
result = new int[count]
i = 0
for each v in values
if a <= v <= b
result[i] = v
i++
return result
Java code:
public class ArrayRange {
public static int[] allMatches(int[] values, int size, int a, int b) {
int count = 0;
for (int i = 0; i < size; i++) {
if(values[i] >= a && values[i] <= b) {
count++;
}
}
int result[] = new int[count];
count = 0;
for (int i = 0; i < size; i++) {
if(values[i] >= a && values[i] <= b) {
result[count++] = values[i];
}
}
return result;
}
public static void main(String[] args) {
int[] a = {11, 3, 9, 4, 2, 5, 4, 7, 6, 0};
int[] returnedArray = allMatches(a, 8, 3, 7);
for (int i = 0; i < returnedArray.length; i++) {
System.out.print(returnedArray[i] + " "
Learn more about program on:
https://brainly.com/question/1538272
#SPJ1