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
How does Quickbooks online use smart learning?
kvasek [131]

Answer:

Quick Books Online uses smart learning in its reconciliation tool to help find any rogue transactions by recognizing if transactions have been excluded erroneously from bank feeds. Because bank feeds includes all transactions of bank account. What 2 reasons might mean a transaction needs to be excluded in bank feeds?

Explanation:

4 0
2 years ago
Read 2 more answers
Great Harvest Bakery purchased bread ovens from New Morning Bakery. New Morning Bakery was closing its bakery business and sold
ddd [48]

Answer:

Particulars                                  Amount

Purchase price                         $700,000

Add: Freight cost                     $35,000

Add: Electrical connections    $5,000

Add: Labor costs                      $37,800

Add: Bred dough used            $900

Add: Safety guards                  <u>$1,500</u>

Total cost of Equipment         <u>$780,200</u>

<u></u>

Note: Repairs cost of $5,000 will not be included

5 0
3 years ago
Assume that Cane normally produces and sells 62,000 Betas and 82,000 Alphas per year. If Cane discontinues the Beta product line
Talja [164]

Answer:

Please find the complete question in the attachment.

Explanation:

\beta the margin of contribution unit= 130-25-22-17-14 \ \ \ \ \ \  \ \ \ \ \ \ \ \ \ \ \ \ \ =52

\alpha Margin Contribution Unit = 90-10-21-7-10\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ = 42

8

Contribution losses =62000\times 42 \ \ \ \ \ \ \ \ \ \ \ \ = -2604000

Fixed cost avoidable =102000\times 20 \ \ \  \ \ \ \ \ \ \ \ \ \ \ \ \ \ = 2040000

The margin of Alpha contributions =17000\times 52 \  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =884000

Fiscal benefits (disadvantage)= 320000

3 0
3 years ago
If the cross-price elasticity of demand between Good A and Good B is 3, the price of Good B increases, and the price elasticity
Morgarella [4.7K]

<u>Answer: </u>

We can expect to see a large change in the quantity demanded for Good A.

<u>Explanation: </u>

  • As the price change in the price of good B is inelastic, it is but clear that the price of good B would not show any fluctuations even if there is an increase or decrease in the demand for good B.
  • As the price of good B is not subject to decrease in the near future, it can be expected that the demand for good A would exhibit a sudden rise.
5 0
4 years ago
Background:
ivann1987 [24]

Answer:

i want to see the answer to this question

3 0
3 years ago
Other questions:
  • Which of the following should have the strongest cause and effect relationship with overhead costs? Non-value-added costs. Cost
    6·1 answer
  • Kraft foods has created five global product divisions (beverages, snacks, cheese and dairy, convenience meals, and grocery) and
    8·1 answer
  • If variable manufacturing overhead is applied on the basis of direct labor-hours and the variable overhead rate variance is favo
    5·1 answer
  • One evening while watching TV, your stomach growls. You see an ad for Subway. You walk to the Subway shop and buy a sandwich, wh
    15·1 answer
  • Rug Designs Inc, a manufacturer of large area rugs, markets its products throughout the United States using a network of regiona
    12·1 answer
  • Joe Bob is the grantor of a deed, and is in the final stages of transferring a deed to the new owner, Frank. What must Joe Bob d
    7·1 answer
  • Please complete the spreadsheet template:
    14·1 answer
  • Assume that a customer shops are a local grocery store spending an average of $400 a week, resulting in the retailer earning a $
    9·1 answer
  • 15 stores and their distribution warehouse. The Paint Supply Store franchise sells an average of 70 gallons of Purple Paint ever
    9·1 answer
  • I just wanna do something fun so, whats an adjective and noun for king?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!