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
If you get a flat in the front of your car, your car will:
juin [17]

Answer:

stop and might even crash

Explanation:

6 0
2 years ago
To revise a monthly budget, changes in which categories might need to be addressed? Check all that apply.
GREYUIT [131]

Income

amount budgeted

expenses

5 0
2 years ago
"A communication between two devices is over the maximum limit of an ethernet frame size. The Transmission Control Protocol (TCP
Sliva [168]

COmmunication Devices

Explanation:

  • TCP/IP, or the Transmission Control Protocol/Internet Protocol, is a suite of communication protocols used to interconnect network devices on the internet. TCP/IP can also be used as a communications protocol in a private network (an intranet or an extranet).

  • The sequence number in a header is used to keep track of which segment out of many this particular segment might be. The next field, the acknowledgment number, is a lot like the sequence number. The acknowledgment number is the number of the next expected segment.

  • The 32 bit sequence number field defines the number assigned to the first byte of data contained in this segment. TCP is a stream transport protocol. To ensure connectivity, each byte to be transmitted is numbered.
3 0
3 years ago
In Illinois, once a person has obtained their boating education certificate what is the minimum age to operate a motorized vesse
bixtya [17]

Answer:

I dont really know, I am sorry, but I am going to ask my teacher

5 0
3 years ago
Read 2 more answers
The primary heat transfer mechanism that quickly warms my hand if I hold it directly above a campfire is: a)-Radiation b)-Induct
Tanzania [10]

Answer:

The correct answer is option 'c':Convection.

Explanation:

When we ignite a campfire the heat produced by combustion heats the air above the fire. As we know that if a gases gains heat it expands thus it's density decreases and hence it rises, if we hold our hands directly above the fire this rising hot air comes in contact with our hands thus warming them.

The situation is different if we are at some distance from the campfire laterally. Since the rising air cannot move laterally the only means the heat of the fire reaches our body is radiation.

But in the given situation the correct answer is convection.  

6 0
3 years ago
Other questions:
  • A heat pump designer claims to have an air-source heat pump whose coefficient of performance is 1.8 when heating a building whos
    10·1 answer
  • An insulated piston–cylinder device initially contains 1 m3 of air at 120 kPa and 17°C. Air is now heated for 15 min by a 200-W
    7·1 answer
  • 4. Which of the following is the first thing you should do when attempting
    13·2 answers
  • Why charles babbage is known as father of computer explain <br>​
    12·1 answer
  • A structural component in the form of a wide plate is to be fabricated from a steel alloy that has a plane strain fracture tough
    10·1 answer
  • The van der Waals equation is a modification of the ideal gas equation. What two factors does this equation account for? A. (1)
    6·1 answer
  • Bore = 3"
    13·2 answers
  • Select four items that an industrial engineer must obtain in order to practice in the field.
    6·2 answers
  • 15- Vipsana's Gyros House sells gyros. The cost of ingredients (pita, meat, spices, etc.) to make a gyro is $2.00. Vipsana pays
    10·1 answer
  • A transformer has 300,000 windings in its primary coil and uses 12,000V AC input. (4 points) How many windings would be needed t
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!