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
Alisiya [41]
3 years ago
10

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: matchValue: 2, userValues: {2, 1, 2, 2} (as in the example program above) matchValue: 0, userValues: {0, 0, 0, 0} matchValue: 10, userValues: {20, 50, 70, 100} (Notes)
Engineering
1 answer:
erica [24]3 years ago
6 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
Substance Specific Heat (cal/g°C) Specific Heat (J/g°C) water 1.00 4.18 steam 0.96 4.02 alcohol 0.59 2.47 ice 0.50 2.09 wood 0.4
Jobisdone [24]

Answer:

C) 43,2°C

Explanation:

<em>Sensible heat</em> is the amount of thermal energy that is required to change the temperature of an object, the equation for calculating the heat change is  given by:

Q=msΔT

where:

  • Q, heat that has been absorbed or realeased by the substance [J]
  • m, mass of the substance [g]
  • s, specific heat capacity [J/g°C]
  • ΔT, changes in the substance temperature [°C]

To solve the problem, we clear ΔT of the equation and then replace our data:

Q=890 [J],

m=16,6 [g],

s=2,74 [J/g°C]

Q=msΔT.......................ΔT=Q/ms

ΔT=\frac{890 J}{16,6g*2,47\frac{J}{gC}}=21,7°C

As:

ΔT=Tfinal-Tinitial

Tfinal=ΔT+Tinitial

Tfinal=21,7+21,5=43,2°C

The final temperature of the ethanol is 43,2°C.

4 0
4 years ago
Your uncle has given you a newmonitor for your computer. When you attempt to connect it, you notice that none of the ports on th
juin [17]

Answer:

Go on amazon and look for HDMI -> (VGA/DVI/HDMI) what ever you need adapters.

6 0
3 years ago
The difference between ideal voltage source and the ideal current source​
DENIUS [597]
An ideal voltage source provides no energy when it is loaded by an open circuit (i.e. an infinite impedance), but approaches infinite energy and current when the load resistance approaches zero (a short circuit). ... An ideal current source has an infinite output impedance in parallel with the source.
5 0
4 years ago
Read 2 more answers
An open glass tube is inserted into a pan of fresh water at 20 °C. What tube diameter is needed to make the height of capillary
kiruha [24]

Answer:

The tube diameter is 2.71 mm.

Explanation:

Given:

Open glass tube is inserted into a pan of fresh water at 20°C.

Height of capillary raise is four times tube diameter.

h = 4d

Assumption:

Take water as pure water as the water is fresh enough. So, the angle of contact is 0 degree.

Take surface tension of water at 20°C as 72.53\times 10^{-3} N/m.

Take density of water as 100 kg/m3.

Calculation:

Step1

Expression for height of capillary rise is gives as follows:

h=\frac{4\sigma\cos\theta}{dg\rho}

Step2

Substitute the value of height h, surface tension, density of water, acceleration due to gravity and contact angle in the above equation as follows:

4d=\frac{4\times72.53\times10^{-3}\cos0^{\circ}}{d\times9.81\times1000}

d^{2}=7.39\times10^{-6}

d=2.719\times10^{-3} m.

Or

d=(2.719\times10^{-3}m)(\frac{1000mm}{1m})

d=2.719 mm

Thus, the tube diameter is 2.719 mm.

 

5 0
4 years ago
Air enters the combustor of a jet engine at p1=10 atm, T1=1000°R, and M1=0.2. Fuel is injected and burned, with a fuel/air mass
snow_lady [41]

Answer:

M2 = 0.06404

P2 = 2.273

T2 = 5806.45°R

Explanation:

Given that p1 = 10atm, T1 = 1000R, M1 = 0.2.

Therefore from Steam Table, Po1 = (1.028)*(10) = 10.28 atm,

To1 = (1.008)*(1000) = 1008 ºR

R = 1716 ft-lb/slug-ºR cp= 6006 ft-lb/slug-ºR fuel-air ratio (by mass)

F/A =???? = FA slugf/slugaq = 4.5 x 108ft-lb/slugfx FA slugf/sluga = (4.5 x 108)FA ft-lb/sluga

For the air q = cp(To2– To1)

(Exit flow – inlet flow) – choked flow is assumed For M1= 0.2

Table A.3 of steam table gives P/P* = 2.273,

T/T* = 0.2066,

To/To* = 0.1736 To* = To2= To/0.1736 = 1008/0.1736 = 5806.45 ºR Gives q = cp(To* - To) = (6006 ft-lb/sluga-ºR)*(5806.45 – 1008)ºR = 28819500 ft-lb/slugaSetting equal to equation 1 above gives 28819500 ft-lb/sluga= FA*(4.5 x 108) ft-lb/slugaFA =

F/A = 0.06404 slugf/slugaor less to prevent choked flow at the exit

5 0
3 years ago
Other questions:
  • Kkhghghglgghklghghghlk
    6·2 answers
  • How dose iorn get forged itno steel?
    10·1 answer
  • Describe the distribution of laminations used in the fabrication of a glulam member that is to be used principally as a bending
    13·1 answer
  • Which clauses in the Software Engineering Code of Ethics are upheld by a whistleblower (check all that apply). a. "Respect confi
    12·1 answer
  • In the High Low Logic Index low levels are bearish and high levels are bullish, generally True False
    13·1 answer
  • Wattage is:
    9·1 answer
  • You are developing a mind map for measuring the viscosity of fluid. At which stage in the process will you specify the equipment
    10·1 answer
  • The aluminum rod (E1 = 68 GPa) is reinforced with the firmly bonded steel tube (E2 = 201 GPa). The diameter of the aluminum rod
    11·1 answer
  • Find I with superposition technique.
    5·1 answer
  • Choose the statement that correctly describes the circuit below. image is not found a. The above circuit is invalid because nMOS
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!