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
When designing a car that runs on wind or Air car . can you tell me the details for the following points Compressed Air Engine:
BabaBlast [244]

Answer:

a)

The crack and connecting rod is used in the design of car.This mechanism is known as slider -crank mechanism.

Components:

1.Inlet tube

2. Wheel

3. Exhaust

4. Engine

5.Air tank

6.Pressure gauge

7.Stand

8. Gate valve

b)

The efficiency of air engine is less as compare to efficiency of electric engine and this is not ecofriendly because it produce green house gases.These gases affect the environment.

c)

it can run around 722 km when it is full charge.

                                                                                                                                                     

5 0
3 years ago
You are working as an electrical technician. One day, out in the field, you need an inductor but cannot find one. Looking in you
telo118 [61]

Answer:

a) the inductance of the coil is 6 mH

b) the emf generated in the coil is 18 mV  

Explanation:

Given the data in the question;

N = 570 turns

diameter of tube d = 8.10 cm = 0.081 m

length of the wire-wrapped portion l =  35.0 cm = 0.35 m

a) the inductance of the coil (in mH)

inductance of solenoid

L = N²μA / l

A = πd²/4  

so

L = N²μ(πd²/4) / l

L = N²μ(πd²) / 4l

we know that μ = 4π × 10⁻⁷ TmA⁻¹

we substitute

L = [(570)² × 4π × 10⁻⁷× ( π × (0.081)² )] / 4(0.35)

L =  0.00841549 / 1.4

L = 6 × 10⁻³ H    

L = 6 × 10⁻³ × 1000 mH

L = 6 mH

Therefore, the inductance of the coil is 6 mH

b)

Emf ( ∈ ) = L di/dt

given that; di/dt = 3.00 A/sec

{∴ di = 3 - 0 = 3 and dt = 1 sec}

Emf ( ∈ ) = L di/dt

we substitute

⇒ 6 × 10⁻³ ( 3/1 )

= 18 × 10⁻³ V

= 18 × 10⁻³ × 1000

= 18 mV  

Therefore, the emf generated in the coil is 18 mV  

7 0
3 years ago
A reservoir is 1 km wide and 10 km long and has an average depth of 100m. Every hour, 0.1% of the reservoir's volume drops throu
Ksju [112]

Answer:

250.7mw

Explanation:

Volume of the reservoir = lwh

Length of reservoir = 10km

Width of reservoir = 1km

Height = 100m

Volume = 10x10³x10³x100

= 10⁹m³

Next we find the volume flow rate

= 0.1/100x10⁹x1/3600

= 277.78m³/s

To get the electrical power output developed by the turbine with 92 percent efficiency

= 0.92x1000x9.81x277.78x100

= 250.7MW

7 0
3 years ago
Technician A says that a way to prevent galvanic corrosion is to duplicate the original installation method. Technician B says t
sertanlavr [38]

Answer:

Technician A

Explanation:

Galvanic corrosion is not on only one metal alone but caused when two metals are interacting. Thus, Duplicating the original installation method is a better option because re-using a coated bolt doesn't prevent galvanic corrosion because both materials must be coated and not just the bolt and in technician B's case he is coating just the bolt. Thus, technician B's method will not achieve prevention of galvanic corrosion but technician A's method will achieve it.

8 0
3 years ago
You can change lanes during a turn long as there’s no traffic and you driving slowly
Vanyuwa [196]
Your allowed to switch lanes as long as the road is clear and you use signals.
5 0
3 years ago
Other questions:
  • Your task is to fill in the missing parts of the C code to get a program equivalent to the generated assembly code. Recall that
    5·1 answer
  • Which of the following does NOT describe product design.
    11·1 answer
  • Superheated steam is stored in a large tank at 6 MPa and 800°C, The steam is exhausted isentropically through a converging-diver
    5·1 answer
  • g A plane stress element has components sigma x = 160 MPa, tau xy = 100 MPa (CW). Determine the two values pf sigma y for which
    13·1 answer
  • Air is cooled and dehumidified as it flows over the coils of refrigeration system at 100 kPa from 30 ºC and relative humidityof
    14·1 answer
  • WHAT IS A TOROID IN HYDRAULUCS?
    11·2 answers
  • List one advantage and one disadvantage of the use of the commutator?
    8·1 answer
  • Refrigerant 134a enters a horizontal pipe operating at steady state at 40°C, 300 kPa, and a velocity of 25 m/s. At the exit, the
    11·1 answer
  • The electrical panel schedules are located on EWR Plan number ___.
    13·1 answer
  • Why does the compression-refrigeration cycle have a high-pressure side and a low-pressure side?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!