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
Consider a fully-clamped circular diaphragm poly-Si with a radius of 250 μm and a thickness of 4 μm. Assume that Young’s modulus
Alina [70]

Answer:

Explanation:

find attached the solution to the question

4 0
3 years ago
A brake caliper is considered a suspension item.<br> True<br> False
user100 [1]
True


Suspension is the system of tires, tire air, springs, shock absorbers and linkages that connects a vehicle to its wheels and allows relative motion between the two.[1] Suspension systems must support both road holding/handling and ride quality
5 0
3 years ago
Determine the velocity of the 13-kgkg block BB in 4 ss . Express your answer to three significant figures and include the approp
Anvisha [2.4K]

Answer:

The question has some details missing : The 35-kg block A is released from rest. Determine the velocity of the 13-kgkg block BB in 4 ss . Express your answer to three significant figures and include the appropriate units. Enter positive value if the velocity is upward and negative value if the velocity is downward.

Explanation:

The detailed steps and appropriate calculation is as shown in the attached file.

6 0
3 years ago
A certain robot can perform only 4 types of movement. It can move either up or down or left or right. These movements are repres
Olegator [25]

Answer:

def theRoundTrip(movement):

   x=0

   y=0

   for i in movement:

       if i not in ["U","L","D","R"]:

           print("bad input")

           return

       if i=="U":

           y+=1

       if i=="L":

           x-=1

       if i=="D":

           y-=1

       if i=="R":

           x+=1

   return x==0 and y==0

8 0
3 years ago
1. What affects the weight of an airplane?<br> a. Mass<br> b. Matter<br> c. Materials<br> d. Speed
BARSIC [14]
Mass affects the weight of an airplane because everything has mass
5 0
2 years ago
Read 2 more answers
Other questions:
  • What is the name of the model/shape below?
    5·2 answers
  • Consider a cubical furnace with a side length of 3 m. The top surface is maintained at 700 K. The base surface has emissivity of
    13·1 answer
  • Describe what V1-V4 is
    10·1 answer
  • Why do many sources of water need treatment
    10·1 answer
  • 10. True or False: You should select your mechanic before you experience vehicle failure.
    6·2 answers
  • Given two alphabet strings str1 and str2. You can change the characters in str1 to any alphabet characters in order to transform
    8·1 answer
  • Describe the are of mechanical engineering
    6·2 answers
  • How many astronauts work<br> in the International Space Station
    7·1 answer
  • Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    9·1 answer
  • In python, how would I randomize numbers and insert them into a file?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!