1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
vaieri [72.5K]
2 years ago
6

Your task is to design a method int[] allMatches(int[] values, int size, int a, int b) that returns all values between a and b i

nclusive in the partially filled array values. For example, if an array a contains 11, 3, 9, 4, 2, 5, 4, 7, 6, 0, then the call allMatches(a, 8, 3, 7) should return an array containing 3, 4, 5, 4, 7. Note that the 6 is not included because it is past the size of the partially filled array. Arrange the pseudocode below in the right order. Not all lines are useful.
ArrayValues. Java Tester.
java for (int v: values)
{ public class ArrayValues public static intti allatches(int[1 values, int size, int, int b) {
} for (int k = 0; k < size; k++) {
int v = values[k]; for (int k = 0; k < size; k++) {
int v = values[k]; for (int v: values) {
result[1] = v; 1++;
}
int count = 0; )
} if (a int[] result = new int[count);
Computers and Technology
1 answer:
iogann1982 [59]2 years ago
5 0

The program that returns all values between a and b inclusive in the partially filled array values is illustrated below.

<h3>What is a program?</h3>

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:

brainly.com/question/1538272

#SPJ1

You might be interested in
Detecta 1 problema
Komok [63]

Answer:

En el factor secundario el problema es la contaminación ambiental y (o) polución.

Explanation:

No solo dentro de las industrias, si no que en todos lados...

Una manera de contrarrestar este problema es reducir el uso de recursos no renovables y utilizar los renovables. En forma de ahorro, los no renovables se podran producir un poco mas y podriamos mantener un buen ciclo de uso.

Espero te sirva!!

3 0
2 years ago
Read 2 more answers
Why is the len ( ) function useful when using a loop to iterate through a stack?
Marizza181 [45]

The len ( ) function will run with each iteration, printing the element number each time.

6 0
2 years ago
Describe and compare imperative (C), functional (SML) and logic (Prolog) programming paradigms.
daser333 [38]

Answer:

Answered below

Explanation:

Imperative programming paradigm is a paradigm in which the programmer tells the machine how to change its state. It is divided into procedural programming, where programs are grouped as procedures, and object-oriented, where programs are grouped together with the properties they operate on.

Imperative paradigm is efficient, familiar and popular compared to others.

Functional programming paradigm implements all instructions as functions, in a mathematical sense. They take on an argument and return a single solution. The advantage of this, compared to other paradigms, is its abstraction and independence.

Logical programming, like functional programming, incorporates a declarative approach to problem solving. All known facts are first established before queries are made. Advantage of this paradigm is that programming steps are kept to a minimum.

6 0
3 years ago
jakie krasnale mieszkaja we wroclawiu i opisz kto napisal kronike, prosze nie kopiowac dlugich tekstow najlepiej by bylo opisac
ASHA 777 [7]
Co kronika czytasz od?

6 0
3 years ago
What is the empty space inside the character 'O' called?
mariarad [96]

Answer:

In typography, a counter is the area of a letter that is entirely or partially enclosed by a letter form or a symbol (the counter-space/the hole of). The stroke that creates such a space is known as a "bowl".

7 0
3 years ago
Other questions:
  • In cell R9, enter a formula using the AVERAGEIF function to determine the average number of years of experience for lifeguards.
    12·1 answer
  • A Windows application which demands a lot of raw processing power to execute repetitive complex calculations is a good candidate
    5·1 answer
  • Sorting table rows is based on the data in the selected        A. cell range.   B. cell.   C. column.   D. row.
    12·2 answers
  • ____ is the only automated disk-to-disk tool that allows you to copy data to a slightly smaller target drive than the original s
    5·1 answer
  • Describe five different ways databases can be processed
    14·1 answer
  • What important feature of an email gives you a clue about what the sender wants to tell you?
    12·2 answers
  • What is the difference between "What I ought to do?" and "What kind of person should I be"?
    12·1 answer
  • Can someone follow my tt its c1ndy.dont.miss
    6·1 answer
  • How to convert binary to decimal <br> Please it’s so hard and what is digital and analogue
    9·1 answer
  • How does a cell phone change the<br> incoming signals from a caller into sound that<br> you can hear
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!