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
What are personal skills?
jok3333 [9.3K]

Answer:

Basically what you are good at

Explanation:

5 0
3 years ago
What happens to an LR if they troll/spam?
Mkey [24]
They have a chance of being blocked
8 0
3 years ago
Find the quotient and the remainder of 11010111 ÷ 1010, assuming that the binary numbers are signed integers in two's complement
andrew-mc [135]

Answer:

Answered

Explanation:

(11010111)_2= -32+8+2+1 = -21

value of 21 = (010101)_2

(100111)_2= -32+4+2+1= -24

value of 25 = (011001)_2

-21\times -25 = 525

525 = (001000001101)_2

5 0
3 years ago
Which of the following is a reliable source of information: a book recommended from my professor, britannica, a blog, or wikiped
ratelena [41]
A book recommended from your professor is a reliable source of information.
8 0
3 years ago
Luentifying message rullidl Upuuns
WITCHER [35]

Answer:

Plain text, Rich Text, and HTML format

Explanation:

In Outlook 2016, three formats are allowed. You can send the plain text only or you can send using the Rich text format. However, there is another sending format as well that is allowed, and it is the HTML format. And by default, if you will let the Outlook choose the most appropriate sending format then the email message will be sent using the HTML format.

7 0
3 years ago
Other questions:
  • Which of the following economic systems leaves production decisions completely up to the producers?
    15·2 answers
  • Write a Python 3 script in PyCharm that will simulate the game of "Rock, Paper, Scissors": Display a header and the simple rules
    8·1 answer
  • Calculate the change in RGDP if the MPC is .6 and initial spending is $500,000.
    8·1 answer
  • Write a c++ program to calculate the approximate value of pi using this series. The program takes an input n that determines the
    13·1 answer
  • Which process centers the spreadsheet's content on the page?
    15·1 answer
  • _______ allows you to add formatting such as shapes and colors to text.
    14·1 answer
  • A=1/2h(a+b) solve for h
    6·1 answer
  • Please tell me the answer
    5·1 answer
  • Which type of film would typically require the least amount of input from a screenwriter?
    10·1 answer
  • Describe the importance of human interaction in a computing system.
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!