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]
4 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]4 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
class bClass{public:void setX(int a);//Postcondition: x = a;void print() const;private:int x;};class dClass: public bClass{publi
MaRussiya [10]

Answer:

The answer to the given question in the option "a".

Explanation:

In the given c++ program the correct sets value of x and y is option a:

void dClass::setXY(int a, int b) //function implementation

{ //function body.

x = bClass.setX(a); //variable x hold value of setX() function.

b = y;  //variable b holds value of y.  

}

And other option are not correct that can be described as:

  • In option b, x is private variable of the base class that is inherit by the derived class but variable y is not part of the base class. that's why it is wrong.
  • In option c, x= a is correct but y=b is not correct. that's why it is wrong.
  • In option d we access the value of the private variable x that is a part of the base class but in this we not use any variable that holds its value. that's why it is wrong.

So the answer to this question is the option "a".  

6 0
3 years ago
Which security procedure is being demonstrated if an administrator is using Wireshark to watch for specific inbound and outbound
defon

Answer:

The correct answer to the following question will be Option C (Firewall monitoring).

Explanation:

Firewall monitoring would be the analysis of essential firewall parameters that play a key role throughout the effective operation of firewalls.

Usually, management of the firewalls should include:

  • Monitoring the firewall file.
  • Management of the firewall statute.
  • Monitoring the design of the firewall.

Firewall security control is shown if the user uses Wire-shark to track relevant incoming and outgoing traffic.

Therefore, Option C is the right answer.

4 0
3 years ago
In computer memory, _____ represents the absence of an electric signal and ____ represents the presence of an electric signal.​
nirvana33 [79]

Answer:

In computer memory, zero(0) represents the absence of an electric signal and 1 represents the presence of an electric signal.​

Explanation:

Computer memory is used to store data in the form of electrical signals. Electrical signal is used to represent the presence or absence of signal. The data is stored in binary form.

Hence,

In computer memory, zero(0) represents the absence of an electric signal and 1 represents the presence of an electric signal.​

7 0
3 years ago
A type of file format to compress files and images allowing them to be stored with less disk space
solniwko [45]
Zip ..........................................
5 0
3 years ago
Clunker Motors Inc. is recalling all vehicles from model years 1995-1998 and 2004-2006. A bool variable named norecall has been
hammer [34]

Answer:

Following are the module in the Python Programming Language.

if((modelYear > 1994 and modelYear < 1999 )or(modelYear > 2003 and modelYear < 2007 )):

   norecall = False

else:

   norecall = True

Explanation:

<u>Following are the description of the program</u>.

All motors vehicles from model years are again called by the following company. A boolean data type variable was declared that is 'norecall'. Due to an integer variable modelYear compose the assertion assigning true to the variable 'norecall', if the variable modelYear initialization is NOT within the two recall frequencies and initialize false otherwise.

6 0
3 years ago
Other questions:
  • Credit card numbers follow a standard system. For example, Visa, MasterCard, and Discpver Card all have 16 digits, and the first
    11·1 answer
  • Why is it important for people to express resentments in the workplace?
    9·1 answer
  • URGENT!
    15·1 answer
  • Jenny wants to create a résumé after a two-years gap. What should she consider?
    11·2 answers
  • There are local administrators for each of the departments, excluding the IT. These local administrators will use the local admi
    7·1 answer
  • What is a well-planned strategy that ensures the search and navigation functions are easy to use and user-friendly on a website?
    15·1 answer
  • Use a for/else loop to traverse through the key names in the dictionary below in order to find Mr. Potatohead’s mailing address.
    7·1 answer
  • Hi, I need help on a Circle Class Assignment that is due today. If anyone could please help me, I would greatly appreciate it. I
    11·1 answer
  • Why does every image on brainly look like this too me?? it started today
    15·2 answers
  • Input an int between 0 and 100 and print the numbers between it and 100, including the number itself and the number 100. If the
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!