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
The electron beam in a TV picture tube carries 1015 electrons per second. As a design engineer, determine the voltage needed to
leonid [27]

Answer:

The voltage needed to accelerate the electron beam is 2.46 x 10^16 Volts

Explanation:

The rate of electron flow is given as:

q = 1015 electrons per second

The total current is given by:

Total Current = (Rate of electron flow)(Charge on one electron)

Total Current = I = (1015 electrons/s)(1.6 x 10^-19 C/electron)

I = 1.624 x 10^-16 A

Now, we know that electric power is given as:

Electric Power = Current x Voltage

P = IV

V = P/I

V = 4 W/1.624 X 10^-16 A

<u>V = 2.46 x 10^16 Volts</u>

6 0
3 years ago
You are using a Jupyter Notebook to explore data in a DataFrame named productDF. You want to write some inline SQL by using the
defon
You need to explain it more simple as everyone is clueless
7 0
3 years ago
A steam power plant is represented as a heat engine operating between two thermal reservoirs at 800 K and 300 K. The temperature
Sergeeva-Olga [200]
Yeet is the answer .....
4 0
3 years ago
HELP PLS
Angelina_Jolie [31]

Answer:

The correct option is;

B) Metamorphic Rocks

Explanation:

Zoisite, which is also referred to saualpite, is a metamorphic rock which is a hydroxy sorosilicate mineral formed from other types of rocks such as sedimentary, metamorphic and ingenious rocks in the process of their metamorphism under the presence high temperatures and pressures and mineral fluids which are hot

Zoiste is named after Sigmund Zois by Abraham Gottlob Werner in 1805 when Sigmund Zois sent Abraham Gottlob Werner the mineral specimen from Saualpe in 1805

6 0
3 years ago
Which type of memory is programmed at the factory? RAM ROM Cache or Virtual memory
12345 [234]

Answer:

RAM, which stands for random access memory, and ROM, which stands for read-only memory, are both present in your computer. RAM is volatile memory that temporarily stores the files you are working on. ROM is non-volatile memory that permanently stores instructions for your computer.

Explanation:

5 0
3 years ago
Other questions:
  • At a certain elevation, the pilot of a balloon has a mass of 120 lb and a weight of 119 lbf. What is the local acceleration of g
    6·1 answer
  • A 5 MW gas turbine power plant is reported to have a thermodynamic efficiency of 35%. Assume products of the combustion reaction
    5·1 answer
  • Consider 1.0 kg of austenite containing 1.15 wt% C, cooled to below 727C (1341F). (a) What is the proeutectoid phase? (b) How
    14·1 answer
  • A freshly annealed glass containing flaws of maximum length of 0.1 microns breaks under a tensile stress of 120 MPa. If a sample
    13·1 answer
  • Give a reason why fighter aircraft use mid-wing design.
    11·1 answer
  • In Josiah Johnson Hawes and Albert Sands Southworth, Early Operation under Ether, Massachusetts General Hospital the elevated vi
    11·1 answer
  • A plumbed eyewash station is portable.
    8·1 answer
  • Storing parts outside doesn't cause any environmental risks as long as the items are covered.
    12·2 answers
  • 2 definiciones de personas en Técnicos en ingeniería eléctrica y agregar link.<br> Por favor❗❗❗
    13·1 answer
  • Someone please please help me and explain!! I will give brainliest if right!!!
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!