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
Mumz [18]
3 years ago
11

Write a for loop that iterates from 1 to numbersamples to double any element's value in datasamples that is less than minvalue.

ex: if minval = 10, then datasamples = [2, 12, 9, 20] becomes [4, 12, 18, 20].
Business
1 answer:
navik [9.2K]3 years ago
5 0

Answer:

for (i = 0; datasamples[i] < NUM_POINTS ; ++i) {

        if(datasamples[i] < minVal) {

        datasamples[i] = datasamples[i] * 2;

     }

 }

Explanation:

In this particular problem, we are trying to look at each value in the datasamples array, and double it. This calls for the use of an index variable.

The index variable will keep track of the position within the array as we move from left to right. Starting on the left, at index 0, we will move right until we are at the end of the array.

++i takes care of incrementing the index variable each time the loop runs. This is what moves through the array.

The termination condition checks whether if we have iterates all values in the array. Once you've gone past all the values in the array the  index variable is pointing all the way at the end.

As soon as the termination condition is false the loop will stop executing. So we will want to run your code while i (the index variable) is less than the size of the array (datasamples.length).

Once you've figured out the for loop bounds, simply check your conditional with an if-then statement before updating the values:

You might be interested in
What is one benefit to working collaboratively on a team
Mamont248 [21]

Answer:

uh it's 2. i would hope that that answer would be obvious

4 0
3 years ago
The following refers classification of space except
crimeas [40]
Bbbbbbbbbbbbbbbbbbbbb
8 0
3 years ago
In the country of Mashwen, the state owns key industries such as energy and transportation. The rest of the industries are priva
zzz [600]

Answer:

Mixed economy.

Explanation:

In the country of Mashwen, the state owns key industries such as energy and transportation. The rest of the industries are privately owned. Mashwen is a <u>Mixed</u> economy.

Mixed economy: It is a shared economy system, which has equal role of private enterprises and public enterprises. In the current global market, most of the economy are mixed economy. It allow private enterprises with equal opportunity to participate in the market, it create healthy competition among different player and buyer can have variety of product at low price.

8 0
3 years ago
Because of its effect on the amount of capital per worker, in the short term an increase in the working population is likely to
Tamiku [17]

Answer:

The correct answer is letter "B": reduce productivity. Other things the same, this decrease will be larger in a poor country.

Explanation:

Labor productivity measures the units a worker can produce per hour. <em>Capital, technology, </em>and <em>human development</em> influence the labor productivity employees could have. Poor countries are characterized by having low investments. If the labor force increases but the capital remains stagnant, the level of productivity is likely to fall since there is a surplus in labor hand.

3 0
3 years ago
Read the following scenario. An urban area in southern Texas is rapidly growing. The population has almost doubled over the past
Alex73 [517]
I'm not 100% sue but I think the answer is option D: District boundaries will remain the same, but the voting pattern will shift from Republican to Democratic. Hope this helps!
7 0
4 years ago
Other questions:
  • Crunch Lite produces six different flavors of sugar-free cookies for the diabetic population. The company also produces a large
    13·1 answer
  • On January 1, Year 1, Dunn Brothers, Inc., purchased a new smartphone case making machine at a cost of $80,000. The estimated re
    12·1 answer
  • The following information applies to the questions displayed below.) Waldorf Co. had the following transactions during the month
    9·1 answer
  • Which type of cybercriminal attack would interfere with established network communication through the use of constructed packets
    12·2 answers
  • Does barritt's ginger beer have alcohol in it
    14·1 answer
  • Managers perform an external analysis so that they know about​ ________.
    10·1 answer
  • A seasonal index for a monthly series is about to be calculated on the basis of three years' accumulation of data. The three pre
    10·1 answer
  • You have just received an offer in the mail from Friendly Loans. The company is offering to loan you $4,500 with low monthly pay
    14·1 answer
  • What is economics as a social science​
    5·2 answers
  • The accountant for Bellows Corp. was preparing a bank reconciliation as of April 30. The following items were identified:
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!