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
Andrej [43]
3 years ago
11

github Portfolio Balances An investor opens a new account and wants to invest in a number of assets. Each asset begins with a ba

lance of o, and its value is stored in an array using 7-based indexing. Periodically, a contribution is received and equal investments are made in a subset of the portfolio. Each contribution will be given by investment amount, start index, end index. Each investment in that range will receive the contribution amount. Determine the maximum amount invested in any one investment after all contributions
Computers and Technology
1 answer:
OLEGan [10]3 years ago
6 0

The following code will be used to determine the maximum amount invested

<u>Explanation:</u>

long maxValue(int n, int rounds_rows, int rounds_columns, int into rounds)

{

   // Define the variable to store

   // the maximum amount invested.

   long max = 0;

   

   // Define an array of size n,

   // to store the n investments.

   long *investments = (long*)malloc(sizeof(long)*n);

   int i=0;  

   // Initially set all

   // the investments to 0.

   for(i=0;i<n;i++)

   {

       investments[i] = 0;

   }

   i=0;

   // Run the loop to

   // perform the rounds.

   while(i<rounds_rows)

   {

       // Get the left value

       // of the current round.

       int left = rounds[i][0];

       

       // Get the right value

       // of the current round.

       int right = rounds[i][1];

       // Get the contribution

       // for the current round.

       int contribution = rounds[i][2];

       // Since the user uses 1-based

       // indexing, subtract 1 from left

       // and right as the program uses

       // 0-based indexing. That is, the

       // investments in the array start

       // from 0 and not 1.

       right = right - 1;

       int j=0;

       // Run the loop to add the

       // contribution to all the investments

       // between left and right, both inclusive.

       for(j=left; j<=right; j++)

       {

           investments[j] += contribution;

       }

       i++;

   }

   // Traverse the investments array

   // to find the maximum element.

   max = investments[0];

   for(i=1; i<n;i++)

   {

       if(investments[i]>max)

       {

           max = investments[i];

       }

   }

   // Return the

   // maximum investment.

   return max;  

}

You might be interested in
Make the list of menu icon in MS Excel<br>​
valina [46]

●file

●home

●insert

●page layout

●formulas

●data

●review

●view

8 0
2 years ago
The mean life of a certain computer hard disk in continual use is 8 years. (a) How long a warranty should be offered if the vend
Allushta [10]

Answer:

a) 0.843 years

b) 1.785 years

Explanation:

See attached pictures for detailed explanation.

4 0
3 years ago
Assume a PHP document named hello.php has been saved in a folder named carla inside the htdocs folder on your computer. Which is
iVinArrow [24]

The available options are:

A. localhost/Carla/hello.php

B. localhost/htdocs/hello.php

C. localhost/htdocs/Carla/hello.php

D. carla/hello.php5

Answer:

C.  localhost/htdocs/Carla/hello.php  

Explanation:

A path in computer programming can be defined as the name of a file or directory, which specifies a unique location in a file system.

Therefore, to get the correct path to enter to view this page in a browser, one needs to follow the directory tree hierarchy, which is expressed in a string of characters in which path components, separated by a delimiting character, represent each directory.

Hence, correct path to enter to view this page in a browser is "localhost/htdocs/Carla/hello.php"

6 0
3 years ago
I need help please?!!!!
mrs_skeptik [129]
It would be wear a seatbelt
6 0
3 years ago
Read 2 more answers
PLEASE HURRY!!
PtichkaEL [24]

Answer: I would say the first one

Explanation: I have never seen an interactive button for use in autoformatting at least on a presentation

8 0
2 years ago
Other questions:
  • What should the timing of transition slides be per minute?
    9·2 answers
  • Write a program that accepts as input the mass, in grams, and density, in grams per cubic centimeters, and outputs the volume of
    14·1 answer
  • What does prominent hyperintensity mean relating to MRI?
    5·1 answer
  • Breaking down a problem to find the solution is called:
    8·1 answer
  • Jenn wants to assign a value to the favorite car variable: favoriteCar = Toyota but gets an error message. What does she need to
    11·1 answer
  • Question 2 of 3
    7·2 answers
  • Create a method called randomValues that uses a while loop to generate a random number between 1-25 until the value 10 is genera
    12·1 answer
  • A ___________ is a variable used to pass information to a method.
    11·2 answers
  • What is Fill handle?
    12·1 answer
  • Consider that a man is watching a picture of a Black Horse. He receives an external stimulus from input channel. Man gains some
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!