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
"A 45-year old man earns $150,000 per year and is covered by his employer's 401(k) Plan. He quits" his job and moves to a new co
DaniilM [7]

Answer:

Not to leave previous job.

Explanation:

  • First of all, the question is that what he will lose after leaving the job?
  • His earning per year is equal at both sides, still what's the opportunity cost for him?

<em>The answer is simple,</em> he may earn equal but if looked at it in a bigger picture he is losing 401k retirement plan and It is his opportunity cost. He may regret this after leaving the job.

7 0
4 years ago
Preparing a Cost of Goods Sold Budget Andrews Company manufactures a line of office chairs. Each chair takes $14 of direct mater
Marta_Voda [28]

Answer:

Cost of goods sold = $960,839

Explanation:

Preparing cost of goods sold budget:

Number of units to be sold = 20,000 - 675 = 19,325

As for the information provided:

Direct Materials = $14 \times 19,325 = $270,550

Direct Labor hours = 1.9 \times 19,325 = 36,717.5

Direct Labor Cost = $16 \times 36,717.5 = $587,480

Variable overhead = $1.20 \times 36,717.5 = $44,061

Fixed overhead  = $1.60 \times 36,717.50 = $58,748

Therefore, cost of goods sold = $960,839.

6 0
3 years ago
5. Max prepares a tax return for Ali at a VITA/TCE site. He finds out during the interview that Ali has no health insurance. Aft
solmaris [256]
Ion know and I wish I did good luck lol
3 0
3 years ago
Delta Distributors has accounts receivable of $2,750,000 and average daily credit sales of $118,280. The firm offers credit term
liq [111]

Answer:

The firm's accounts receivable period is 23.25 days

Explanation:

Accounts receivable period = 365 / Account receivable turnover ratio

When Account receivable turnover ratio = Net sales / Account receivables

Account receivable turnover ratio = 118,280 * 365 days/ 2,750,000

Account receivable turnover ratio = 15.698

Hence, Account receivable period = 365 / 15.698

Account receivable period = 23.25 days

3 0
3 years ago
At the end of the listening process you ______________. a. choose a sound to focus on b. make an effort for recall c. provide fe
sergij07 [2.7K]
Provide feedback is your correct answer
3 0
3 years ago
Read 2 more answers
Other questions:
  • Blake Williams has done some research and has discovered that economists believe interest rates will rise significantly over the
    5·2 answers
  • List three strategies for seeing that your guests do not leave your home or residence while impaired
    7·1 answer
  • W gave w's age as 50 when w purchased a life policy. at the time of w's death seven years later, the company discovered w's true
    8·1 answer
  • What type of cost is the cost of goods or services sold? A. Salaried B. Markup C. Variable D. Fixed
    6·2 answers
  • Customer service in the aviation industry slideshare
    11·1 answer
  • Valet Corporation began operations in 2018. An analysis of Valet's debt securities portfolio acquired in 2018 shows the followin
    10·1 answer
  • During the first month of operations ended August 31, Kodiak Fridgeration Company manufactured 48,000 mini refrigerators, of whi
    12·1 answer
  • Which federal regulatory agency would most likely bring a civil suit against a business that broke securities laws?
    9·1 answer
  • All of the following would be considered examples of employer postretirement benefits EXCEPT
    11·1 answer
  • All of the following are benefits of workforce diversity except:_____.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!