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
Convenience goods like Coke are available almost everywhere in the United States. Thus, Coke uses ______ distribution:
Doss [256]

Convenience products like Coke are available almost everywhere in the United States. Thus, Coke uses intensive distribution, which is related to the strategy of making the product available at many different retailers.

This is a marketing strategy widely used by companies that supply non-durable consumer goods, which are those that are consumed quickly, such as food, beverages and medications.

Therefore, non-durable goods such as Coke need to be replenished quickly, justifying the company's intensive distribution strategy, which makes its products easily available to consumers, increasing its profitability and positioning.

Learn more here:

brainly.com/question/3520708

7 0
2 years ago
Feeling "He who does the work of the King ought to be King," Pope Zacharias helped whom become King of the Franks in 751?
Gnom [1K]

Answer:

(C) Pepin The Short

Explanation:

In 741AD, Pepin took over from his father as Mayor of the Palace. He ruled alongside his elder brother.

In 743AD, Pepin and his brother chose Childeric to be the <em>apparent</em> King of the Franks. Both brothers still wielded the functional power to the throne. Childeric was just to 'appear to be' the King (unknown to him though).

In 747AD, Pepin's brother stepped down (intentionally and on his own accord). Pepin then became the only ruler of the entire Frankish territory.

In 751AD, Pepin, without full support from his clan, lured Childeric into monastery in order to remove him as the 'face of Francia'.

Pope Zacharias helped Pepin to be proclaimed King of the Franks, against all opposition.

3 0
3 years ago
Question: 1 of 37: Alice earned $622.50 in interest on her savings in the bank. Before interest, the account had $12,450. What i
SpyIntel [72]
<span>Alice had original amount = $12,450. She earned an interest of $622.50 on the original amount. To find the percent, say, $622.50 = x% of $12,450, we get x% = 0.05 or x = 5%. Thus, Alice earned approximately 5% of the interest.</span>
8 0
3 years ago
The economic order quantity (EOQ) model is a classical model used for controlling inventory and satisfying demand. Costs include
nikklg [1K]

Answer:

Check the explanation

Explanation:

The above question is based on a non-linear programming model, to answer this question, there will be a need to determine the optimal order quantities of the three different Ferns with diverse values of annual demand, item cost as well as order cost objective of the non-linear programming model is to minimize the overall annual cost.

Step 1: Setup a spreadsheet on Excel, as shown in the first and second attached images below:

Note: The values of quantities of the three items is kept as 1 to for the calculations of total cost.

The Solver dialogue box will appear. Enter the decision variables, objective function and the constraints, as shown in the third attached image below:

7 0
3 years ago
Splish Inc. had pretax financial income of $139,400 in 2020. Included in the computation of that amount is insurance expense of
RoseWind [281]

Answer:

The Journal entry and their narrations is shown below:

Explanation:

The Journal entry is shown below:-

Income tax expenses Dr,         $43,140

        To income tax payable                    $40,140

         To Deferred tax liability                  $3,000

(Being Income tax expenses for the year is recorded)

Working Note 1:-

Income as per tax purpose

Pretax financial income                   $139,400

Add: permanent difference

Disallowed insurance expenses     $4,400

Less: Timing difference

Excess depreciation allowed            $10,000

Income as per tax purpose                 $133,800

Working Note 2

Income tax payable

= Income tax rate × Income as per tax purposes

= 30% × $133,800

= $40,140

Working Note 3

Deferred tax liability = Timing difference × Tax rate

= $10,000 × 30%

= $3,000

6 0
3 years ago
Other questions:
  • The market demand for wheat is Q = 100 − 2p + 1pb + 2Y . If the price of wheat, p, is $2, and the price of barley, pb, is $3, an
    9·1 answer
  • Joe feels that failing his math test is due to an external locus of control that is unstable in nature. what will he attribute h
    7·1 answer
  • The original price is $28.00 the tax is 7.25% what is the total
    14·1 answer
  • One measure of the extent of competition in an industry is the concentration ratio. what level of concentration indicates that a
    11·1 answer
  • Revenues that are legally restricted for expenditure on specified operating purposes should be accounted for in special revenue
    12·1 answer
  • What type of fiscal policy calls for a decrease in government spending and an increase in taxes?
    14·1 answer
  • Mix Sweet Shop bakes and sells pies. Mix has annual fixed costs of​ $880,000 and a variable cost per pie of​ $7.50. Each pie sel
    7·1 answer
  • ___________ is the current strategy for many manufacturers where a company produces a large quantity of items but customizes the
    15·1 answer
  • For each of the statements below, use the dropdown box to select the response that completes the sentence correctly. Knowledge C
    6·1 answer
  • In verifying debits to perpetual inventory records of a nonmanufacturing firm, the auditor would be most interested in examining
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!