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
How do science, mathematics, and technology each influence engineering
Cerrena [4.2K]

Answer:

In order to start engineering you must know the basics Science, Math, and Technology. For example you need math to get all the parts in the right place and fix any pieces that need to be angled right, science because you need to know what happens if you put this with that if it’ll spark break or anything, and technology because you need to know the different pieces and their purpose, hope it helps!

Explanation:

6 0
3 years ago
Read 2 more answers
IF YOU COULD CREATE A SOCIAL NETWORK:, what would it be like? What would make it so special about the others? (If you want you c
frosja888 [35]

It would be like instagram

3 0
3 years ago
Enzo is writing a paper about the similarities and differences between ancient Rome and modern America. Which text structure is
GenaCL600 [577]

Answer:

The correct answer is <em><u>B.) comparison and contrast</u></em>

Explanation:

just did the unit test review. you are welcome

4 0
3 years ago
Read 2 more answers
The layout gallery displays 10 slide layouts with a variety of placeholders to define text and content positioning and formattin
Papessa [141]
The above statement is FALSE.

The layout gallery displays 9 slide layouts NOT 10. 

These 9 layouts have various<span> placeholders to define text and content positioning and formatting.

</span>1 - Title slide
2 - Title and content
3 - Section Header
4 - Two content
5 - Comparison
6 - Title only
7 - Blank 
8 - Content with Caption
9 - Picture with Caption
8 0
3 years ago
Write a program that asks the user to enter a birth year. the program should then indicate which generation a person of that yea
USPshnik [31]
Something like the following. Also you need to give what language you are using. Anyways, you should be able to convert this to your language of choice. 

<script type="text/javascript">
function checkGeneration() { 
   var gen = ["Baby Boomer ","Generation X","Xennials","Generation Y"];
   var reversestr = "";
   var getyear = window.prompt("Enter a 3 digit number: ");
    if (parseInt(getyear) <= 1964) {
        alert(gen[0]);   
    } else if(parseInt(getyear) <= 1979) {
        alert(gen[1]);
    } else if(parseInt(getyear) <= 1985) {
        alert(gen[2]);               
   }  else if(parseInt(getyear) <= 1995) {
        alert(gen[3]);
   }
 }
checkGeneration();
</script>
7 0
2 years ago
Other questions:
  • A. True
    6·1 answer
  • Help me out for this one
    12·1 answer
  • Which of the four basic functions of a computer refers to the collection of data by a computer?
    11·2 answers
  • 11. John wants to share resources and move a large volume of data quickly over the Internet. John should use which of the follow
    14·1 answer
  • A _____ is the useful part of a transmission through a network.
    15·1 answer
  • In python,_______ are used to define the conditions necessary for a while loop to run.
    7·2 answers
  • How should you set the OHMS ADJust control on a multitester of analog VOM, for resistance measurements?
    12·1 answer
  • What should you do to help prepare yourself for the delivery of your presentation? you can chose more then one
    8·1 answer
  • Question 21 pts How many lines should an email signature be? Group of answer choices "5 to 6" "7 to 8" "1 to 2" "3 to 4"
    10·1 answer
  • If you are a mathematics student and want to study the secret of writing cryptographic codes, algorithms, encryption and decrypt
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!