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
Lapatulllka [165]
3 years ago
14

Assign numMatches with the number of elements in userValues that equal matchValue. userValues has NUM_VALS elements. Ex: If user

Values is {2, 1, 2, 2} and matchValue is 2 , then numMatches should be 3. Your code will be tested with the following values: userValues: {2, 1, 2, 2}, matchValue: 2 userValues: {0, 0, 0, 0}, matchValue: 0 userValues: {20, 50, 70, 100}, matchValue: 10 import java.util.Scanner; public class FindMatchValue { public static void main (String [] args) { Scanner scnr = new Scanner(System.in); final int NUM_VALS = 4; int[] userValues = new int[NUM_VALS]; int i; int matchValue; int numMatches = -99; // Assign numMatches with 0 before your for loop matchValue = scnr.nextInt(); for (i = 0; i < userValues.length; ++i) { userValues[i] = scnr.nextInt(); } /* Your solution goes here */ System.out.println("matchValue: " + matchValue + ", numMatches: " + numMatches); } }
Engineering
1 answer:
Thepotemich [5.8K]3 years ago
8 0

Answer:

import java.util.Scanner;

public class FindMatchValue {

  public static void main (String [] args) {

     Scanner scnr = new Scanner(System.in);

     final int NUM_VALS = 4;

     int[] userValues = new int[NUM_VALS];

     int i;

     int matchValue;

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

     matchValue = scnr.nextInt();

     for (i = 0; i < userValues.length; ++i) {

        userValues[i] = scnr.nextInt();

     }

     /* Your solution goes here */

         numMatches = 0;

     for (i = 0; i < userValues.length; ++i) {

        if(userValues[i] == matchValue) {

                       numMatches++;

                }

     }

     System.out.println("matchValue: " + matchValue + ", numMatches: " + numMatches);

  }

}

You might be interested in
Two solid yellow center lines on a two-lane highway indicate:
Vladimir79 [104]
That you can pass the person in front of you while using the other lane
4 0
2 years ago
Read 2 more answers
Why excess air is required to burn a fuel completely
8_murik_8 [283]

Explanation:

excess air is required to ensure adequate mixing of fuel and air, avoid smoke, minimize sg in Coal burning, and to ensure maximum steam output.

5 0
3 years ago
Read 2 more answers
Solve the inequality. Then graph your solution.<br> -9v – 10 &lt; 7y +6
Cerrena [4.2K]
16

if you add 9+10 you get 18 - 7+6
5 0
2 years ago
A complete mix of an activated sludge system without primary clarification is used for treatment of municipal wastewater with a
Hitman42 [59]

Answer:

sorry di ko alam

Explanation:

4 0
2 years ago
Technician A says test lights are great for performing simple tests. Technician B says you can use a test light to check SRS cir
adoni [48]

The technician that is correct about either testing lights for simple tests or to check SRS Circuits is; Technician A.

<h3>Which Technician is Correct?</h3>

First of all it is pertinent to note that test lights are generally small bulbs that are turned on by the voltage and current flowing through the circuit in analog circuits.

Now, the  two values ​​of voltage and current are high and sufficient to light up the bulb. However, in digital circuits, the current is very small in the order of milliamps, and as a result there is not enough power to turn on the lights.

Thus, we can conclude that Technician A is correct.

Read more about Correct Technician at; brainly.com/question/14449935

5 0
2 years ago
Other questions:
  • Two AAA-size lithium batteries are connected in series in a flashlight. Each battery has 3.5 volt and 4- Amp-hour capacity. If t
    8·1 answer
  • What is Differential Analysis in fluid mechanics?
    13·1 answer
  • A rectangular block having dimensions 20 cm X 30 cm X 40 cm is subjected to a hydrostatic stress of -50 kPa (i.e. under compress
    15·1 answer
  • A banked highway is designed for traffic moving at v = 88 km/h. The radius of the curve r = 314 m. show answer No Attempt 50% Pa
    5·2 answers
  • The assembly consists of two blocks A and B, which have a mass of 20 kg and 30 kg, respectively. Determine the distance B must d
    14·2 answers
  • What are the equipment requirements for windshields and side windows?
    13·1 answer
  • A plane wall of thickness 2L = 40 mm and thermal conductivity k = 5 W/m K experiences uniform volumetric heat generation at a ra
    15·1 answer
  • What is the difference between digital instruments and decimal scaled instruments to measure
    6·1 answer
  • Can U lose a rank in Brainly by using too many points?
    6·1 answer
  • A hammer can be used to see how a mineral breaks. If you observe square chunks of the mineral when broken, what can you conclude
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!