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
SSSSS [86.1K]
3 years ago
6

Set numMatches to the number of elements in userValues (having NUM_VALS elements) that equal matchValue. Ex: If matchValue = 2 a

nd userValues = {2, 2, 1, 2}, then numMatches = 3.
import java.util.Scanner;
public class FindMatchValue {
public static void main (String [] args) {
final int NUM_VALS = 4;
int[] userValues = new int[NUM_VALS];
int i = 0;
int matchValue = 0;
int numMatches = -99; // Assign numMatches with 0 before your for loop
userValues[0] = 2;
userValues[1] = 2;
userValues[2] = 1;
userValues[3] = 2;
matchValue = 2;
Computers and Technology
1 answer:
xenn [34]3 years ago
5 0

Answer:

import java.util.Scanner;

public class FindMatchValue {

public static void main (String [] args) {

   final int NUM_VALS = 4;

   int[] userValues = new int[NUM_VALS];

   int i = 0;

   int matchValue = 0;

   int numMatches = -99; // Assign numMatches with 0 before your for loop

   userValues[0] = 2;

   userValues[1] = 2;

   userValues[2] = 1;

   userValues[3] = 2;

   matchValue = 2;

   numMatches=0;

   for(i=0;i<NUM_VALS;i++)

   {

       if(userValues[i]==matchValue)//cheking if the array element is equal to match value.

       {

           numMatches++;

           

       }

   }

   System.out.println(numMatches);//printing the matchvalue.

}

}

Output:-

3

Explanation:

First I have set the value numMatches to 0 before the loop.Then I have user the for loop to iterate over the array.In the for loop I am checking that the array element is equal to the matchValue or not if it is equal then increasing the numMatches by 1.Then at last print the value of numMatches.

You might be interested in
In the beginning of a presentation, it is important to:
tangare [24]

I think it is better to ask questions and troduce yourself

4 0
3 years ago
Which biometric technique is considered nearly infallible from a scientific point of view and is increasingly preferred by crimi
Sergio039 [100]

Answer:

DNA analysis

Explanation:

DNA is unique for all individuals. DNA analysis is the process of analysing the DNA characteristics of an individual.

DNA profiling is used in forensics to identify the suspects involved in criminal activities.

1. In the process, DNA of the suspects is matched with the DNA found in the site of the crime.

2. If a match is found, it indicates that the genetic relationship exists between the suspect and the criminal or the crim.

3. The order from the court is needed to obtain the DNA of the suspects. The sample can be in the form of blood or saliva.

4. The sample obtained should have adequate cells which contain the DNA.

Issues  

The DNA obtained from the crime site is not pure or proper enough to be ideal for the DNA profiling.

Degraded sample

1. The sample obtained from the site of the crime is not always adequate to obtain the actual DNA.

2. The sample can be contaminated due to the environmental factors.

3. The sample obtained is too less and hence, should be examined accurately in order not to waste the sample.

DNA mixture

4. The sample obtained from the site of the crime is found to contain DNA from more than one individual.

 

Profiling types

DNA profiling can be carried out by using any of the techniques mentioned below.

1. RFLP analysis (  Restriction fragment length polymorphism )

This uses the Southern blot technique. The blot process needs a large amount of the sample. Also, this works well only when the sample is not degraded.

2. Polymerase chain reaction (PCR) analysis

3. STR analysis ( short tandem repeats )

4. AFLP ( amplified fragment length polymorphism )

This is an automated and low-cost process. It is easy to set up and operate which makes this process common in low income countries.

All the methods mentioned above have their own advantages and drawbacks.

5 0
3 years ago
Which three pieces of information should be included in an artist statement? Select all that apply.
Dima020 [189]

Answer:

There is no answers given??

Explanation:

N/A

4 0
3 years ago
1. Engineers should not consult with experts if they do not know much about a problem.
Ganezh [65]
1. false
2. d
3. b
4. a
5. b
6.c
7. b
8.a
9. d
10. b
11. d
12.a 
13. c
14. c
15. a
5 0
3 years ago
How many parameters go into the function sum, and how many return values come out of the function sum? function sum(first, secon
zhannawk [14.2K]

Answer:

3 parameters are passed into the function.

1 value will be returned from the function.

Explanation:

From the function definition "function sum(first, second, third)", we can see  that there are three value/parameters are passed in the function.Then variable "result" will be the sum all the three values. After that it will print the all three values in new line. Then the function will return one value which is the  sum of all three that is value of "result".As there is only one value returned  by the return statement in the function.

6 0
4 years ago
Other questions:
  • What type of elements are bridges exposed to yearly
    13·2 answers
  • What is the best way to protect computer equipment from damage caused by electrical spikes?
    9·2 answers
  • What weight pencil is recommended for darkening lines and for lettering? *
    7·2 answers
  • A(n) ________ is a special value that cannot be mistaken as a member of a list of data items and signals that there are no more
    9·1 answer
  • ​open-source software is​ ________.
    11·1 answer
  • The parameter passing mechanisn used in C is
    5·2 answers
  • Describe in detail what each step would look like if you ran into a software error.
    7·1 answer
  • The most important part of a computer​
    14·2 answers
  • What do we call the software which programmers use to program?​
    6·1 answer
  • The ______ process retains copies of data over extended periods of time in order to meet legal and operational requirements.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!