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
What can be used to relieve stress in a weld.
satela [25.4K]
Yes , of course you can
3 0
3 years ago
Read 2 more answers
What is the reason for the development of new construction of materials for human use? (Select all that apply.)
salantis [7]

Answer:

All 4 could be justified.

Explanation:

They all represent ultimate improvement.

7 0
3 years ago
2. What is an important aspect of the American free enterprise system that encourages people to
rusak2 [61]
Have a positive mindset and attitude
7 0
3 years ago
Read 2 more answers
Two rods, with masses MA and MB having a coefficient of restitution, e, move along a common line on a surface, figure 2. a) Find
ahrayia [7]

Answer:

A.) Find the answer in the explanation

B.) Ua = 7.33 m/s , Vb = 7.73 m/s

C.) Impulse = 17.6 Ns

D.) 49%

Explanation:

Let Ua = initial velocity of the rod A

Ub = initial velocity of the rod B

Va = final velocity of the rod A

Vb = final velocity of the rod B

Ma = mass of rod A

Mb = mass of rod B

Given that

Ma = 2kg

Mb = 1kg

Ub = 3 m/s

Va = 0

e = restitution coefficient = 0.65

The general expression for the velocities of the two rods after impact will be achieved by considering the conservation of linear momentum.

Please find the attached files for the solution

6 0
3 years ago
The current entering the positive terminal of a device is i(t)= 6e^-2t mA and the voltage across the device is v(t)= 10di/dtV.
liberstina [14]

Answer:

a) 2,945 mC

b) P(t) = -720*e^(-4t) uW

c) -180 uJ

Explanation:

Given:

                           i (t) = 6*e^(-2*t)

                           v (t) = 10*di / dt

Find:

( a) Find the charge delivered to the device between t=0 and t=2 s.

( b) Calculate the power absorbed.

( c) Determine the energy absorbed in 3 s.

Solution:

-  The amount of charge Q delivered can be determined by:                      

                                       dQ = i(t) . dt

                  Q = \int\limits^2_0 {i(t)} \, dt = \int\limits^2_0 {6*e^(-2t)} \, dt = 6*\int\limits^2_0 {e^(-2t)} \, dt

- Integrate and evaluate the on the interval:

                   = 6 * (-0.5)*e^-2t = - 3*( 1 / e^4 - 1) = 2.945 C

- The power can be calculated by using v(t) and i(t) as follows:

                 v(t) = 10* di / dt = 10*d(6*e^(-2*t)) /dt

                 v(t) = 10*(-12*e^(-2*t)) = -120*e^-2*t mV

                 P(t) = v(t)*i(t) = (-120*e^-2*t) * 6*e^(-2*t)

                 P(t) = -720*e^(-4t) uW

- The amount of energy W absorbed can be evaluated using P(t) as follows:

                 W = \int\limits^3_0 {P(t)} \, dt = \int\limits^2_0 {-720*e^(-4t)} \, dt = -720*\int\limits^2_0 {e^(-4t)} \, dt

- Integrate and evaluate the on the interval:

                  W = -180*e^-4t = - 180*( 1 / e^12 - 1) = -180uJ

6 0
3 years ago
Other questions:
  • Researchers compared protein intake among three groups of postmenopausal women: (1) women eating a standard American diet (STD),
    14·1 answer
  • Tranquilizing drugs that inhibit sympathetic nervous system activity often effectively reduce people's subjective experience of
    8·1 answer
  • The button on the _ valve should be held when pressure bleeding the brakes
    8·1 answer
  • Give a reason why fighter aircraft use mid-wing design.
    11·1 answer
  • Consider a section of muscle tissue of a cylindrical shape with a radius of 1.5 cm. During highly rigorous exercise, metabolic p
    8·1 answer
  • A subsurface exploration report shows that the average water content of a fine-grained soil in a proposed borrow area is 22% and
    9·1 answer
  • The MOST common injury causing absence from work is
    7·2 answers
  • Please look at the attachments and help me with these questions
    7·1 answer
  • A school is playing $0.XY per kWh for electric power. To reduce its power bill, the school installs a wind turbine with a rated
    6·1 answer
  • Where would the impossible amount of product 1 and 2 points intersect on the production possibility curve
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!