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
A can of engine oil with a length of 150 mm and a diameter of 100 mm is placed vertically in the trunk of a car. On a hot summer
igomit [66]

Answer:

6.6516 W

Explanation:

The film temperature is given as the average of the two temperatures, hence (43 + 17)/2 = 30°C.

8 0
3 years ago
Three 1.83 in. diameter bolts are used to connect the axial member to the support in a double shear connection. The ultimate she
seraphim [82]

Answer: the allowable load P is 242.7877 kips

Explanation:

Given that;

diameter bolts d = 1.83 in

ultimate shear strength of the bolts = 60 ksi

we know that

shear area = 2×(π/4)d²

= 2×(π/4)×(1.83)² = 5.2604 in²

so

p/3(5.2604) = 60000/3.9

p/15.7812 = 15384.6153

p = 15.7812 × 15384.6153

p = 242787.691 lb

p = 242.7877 kips

therefore the allowable load P is 242.7877 kips

3 0
3 years ago
A long rod of 60-mm diameter and thermophysical properties rho=8000 kg/m^3, c=500J/kgK, and k=50 W/mK is initally at a uniform t
Monica [59]

Answer:

Tc = 424.85 K

Explanation:

Given that,

D = 60 mm = 0.06 m

\rho = 8000 kg/m^3

k = 50 w/m . kc = 500 j/kg.k

h_{\infty} = 1000 w/m^2t_{\infity} = 750 kt_w = 500 K

surface area = As = \pi dL \\\frac{As}{L} = \pi D = \pi \timeS 0.06

HEAT FLOW Q  is

Q = h_{\infty} As (T_[\infty} - Tw)  = 1000 \pi\times 0.06 (750-500)

 = 47123.88 w per unit length of rod

volumetric heat rate

q = \frac{Q}{LAs}

= \frac{47123.88}{\frac{\pi}{4} D^2 \times 1}

q = 1.66\times 10^{7} w/m^3

Tc = \frac{- qR^2}{4K} + Tw

= \frac{ - 1.67\times 10^7 \times (\frac{0.06}{2})^2}{4\times 50} +  500

  = 424.85 K

3 0
2 years ago
To reduce the drag coefficient and thus improve the fuel efficiency of cars,the design of side rearview mirrors has changed dram
marissa [1.9K]

Answer:

Amount of fuel used per year is supposed to be 34150 KJ/kg

4 0
3 years ago
A 150-lbm astronaut took his bathroom scale (a spring scale) and a beam scale (compares masses) to the moon where the local grav
kozerog [31]

Answer:

a)Wt =25.68 lbf

b)Wt = 150 lbf

F= 899.59 N

Explanation:

Given that

g = 5.48 ft/s^2.

m= 150 lbm

a)

Weight on the spring scale(Wt) = m g

We know that

1\ lbf=32.17 \ lmb.ft/s^2

Wt = 150 x 5.48/32 lbf

Wt =25.68 lbf

b)

On the beam scale

This is scale which does not affects by gravitational acceleration.So the wight on the beam scale will be 150 lbf.

Wt = 150 lbf

If the plane is moving upward with acceleration 6 g's then the for F

F = m a

We know that

1\ ft/s^2= 0.304\ m/s^2

5.48\ ft/s^2= 1.66\ m/s^2

a=6 g's

a=9.99\ m/s^2

So

F = 90 x 9.99 N

F= 899.59 N

3 0
3 years ago
Other questions:
  • The boiler pressure is 38bar and the condenser pressure 0.032 bar.The saturated steam is superheated to 420 oC before entering t
    8·1 answer
  • Drag each tile to the correct box.
    15·1 answer
  • Please read
    6·1 answer
  • Which of the following manufacturing tools machines parts by moving the part into the cutting tool (instead of moving the cuttin
    13·1 answer
  • Write the following statements as Prolog clauses, in the order given: If it is raining or snowing, then there is precipitation.
    15·1 answer
  • A car is stopped at an entrance ramp to a freeway; its driver is preparing to merge. At a certain moment while stopped, this dri
    10·1 answer
  • Module 42 Review and Assessment
    7·1 answer
  • Please help i will give brainilest
    12·2 answers
  • Practice finding the volume of a sphere.
    10·2 answers
  • The build up of electrons will cause electrical called ?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!