answer.
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
MAVERICK
1 month 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:
Rzqust [894]1 month ago
6 0

This code serves to find out the highest amount invested

Explanation:

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

{

   // Variable declaration to hold

   // the highest investment amount.

   long max = 0;

   

   // Creating an array of size n,

   // to keep track of the n investments.

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

   int i=0;  

   // Initialize all

   // investments to zero.

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

   {

       investments[i] = 0;

   }

   i=0;

   // Execute the loop to

   // conduct the rounds.

   while(i<rounds_rows)

   {

       // Acquire the left value

       // for the current round.

       int left = rounds[i][0];

       

       // Acquire the right value

       // for this round.

       int right = rounds[i][1];

       // Get the contribution

       // for this round.

       int contribution = rounds[i][2];

       // Because user indexing is 1-based,

       // subtract 1 from left

       // and right as the program employs

       // 0-based indexing. The

       // array investments begins

       // at 0 and not 1.

       right = right - 1;

       int j=0;

       // Execute loop to distribute the

       // contribution across all investments

       // from left to right, inclusive.

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

       {

           investments[j] += contribution;

       }

       i++;

   }

   // Traverse the investments array

   // to locate the maximum value.

   max = investments[0];

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

   {

       if(investments[i]>max)

       {

           max = investments[i];

       }

   }

   // Return the

   // highest investment.

   return max;  

}

You might be interested in
A 1.17 g sample of an alkane hydrocarbon gas occupies a volume of 674 mL at 28°C and 741 mmHg. Alkanes are known to have the gen
Natasha_Volkova [897]

Answer:

C3H8

Explanation:

Step 1:

Relevant details from the question are noted below:

Mass of the alkane is 1.17g

Volume (V) = 674 mL

Temperature (T) = 28°C

Pressure (P) = 741 mmHg.

Gas constant (R) = 0.08206 atm.L/Kmol

Step 2:

Convert to the appropriate units.

For Volume:

1000mL = 1L

So, 674mL = 674/1000 = 0.674L

For Temperature:

Temperature in Kelvin = Temperature in Celsius + 273

Temperature in Celsius = 28°C

Temperature in Kelvin = 28°C + 273 = 301K

For Pressure:

760mmHg = 1atm

So, 741 mmHg = 741/760 = 0.975atm

Step 3:

Calculate the moles of the alkane.

The moles of the alkane can be found using the ideal gas equation, presented below:

Volume (V) = 0.674L

Temperature (T) = 301K

Pressure (P) = 0.975atm

Gas constant (R) = 0.08206 atm.L/Kmol

Number of moles (n) =?

PV = nRT

n = PV /RT

n = (0.975 x 0.674)/(0.08206x301)

n = 0.0266 moles

Step 4:

Calculate the alkane’s molar mass.

Mass of alkane = 1.17g

Number of moles = 0.0266moles

Molar Mass =?

Number of moles = Mass/Molar Mass

Molar Mass = Mass/Number of moles

Molar Mass of alkane = 1.17/0.0266 = 44g/mol

Step 5:

Determine the molecular formula of the alkane.

This is based on:

The general formula for alkanes is CnH2n+2

To find the molecular formula, we start with n = 1, 2, 3, etc., until we find the molar mass of 44.

When n = 1

CnH2n+2 = CH4 = 12 + (4x1) = 16g/mol

When n = 2

CnH2n+2 = C2H6 = (12x2) + (6x1) = 30g/mol

When n = 3

CnH2n+2 = C3H8 = (12x3) + (8x1) = 44g/mol

It can be observed that for n equal to 3, the molar mass is 44g/mol.

Thus, the molecular formula of the alkane is C3H8.

7 0
29 days ago
During normal Windows operations, you receive a BSOD, and your computer shuts down. You restart the computer and receive the err
Amiraneli [921]
The correct answer to this query is "Hard drive." Explanation: Given the context of the inquiry, it's suggested that the most likely cause of this issue is the improper connection of the video cable. An incorrectly connected video cable can lead to display disruptions, such as the screen flashing black. While overheating of the GPU could also be a potential cause, it typically results in visual artifacts rather than shifting displays. Therefore, "Hard drive" is indeed the right answer.
4 0
16 days ago
Given main(), define the Team class (in file Team.java). For class method getWinPercentage(), the formula is:teamWins / (teamWin
amid [805]

Answer:

Explanation:

public class Team {

   private String teamName;

   private int teamWins;

   private int teamLosses;

   public String getTeamName() {

       return teamName;

   }

   public void setTeamName(String teamName) {

       this.teamName = teamName;

   }

   public int getTeamWins() {

       return teamWins;

   }

   public void setTeamWins(int teamWins) {

       this.teamWins = teamWins;

   }

   public int getTeamLosses() {

       return teamLosses;

   }

   public void setTeamLosses(int teamLosses) {

       this.teamLosses = teamLosses;

   }

   public double getWinPercentage() {

       return teamWins / (double) (teamWins + teamLosses);

   }

}

7 0
13 days ago
To encourage good grades, Hermosa High School has decided to award each student a bookstore credit that is 10 times the student’
amid [805]

Answer:

// here's the Java code.

import java.util.*;

// definition of the class

class BookstoreCredit

{

/* method that prints a message including the name and grade point */

   public static void fun(String name,double grade)

   {

// multiplying grade by 10

       grade=grade*10;

// display the message

       System.out.println(name+"\'s average grade is $"+grade);

   }

// main method for the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // scanner instance to read input

       Scanner s=new Scanner(System.in);

        // declaring variables

      String s_name;

      double grade;

      System.out.print("Please enter the name:");

      s_name=s.nextLine();

      System.out.print("Please enter the grade point:");

      grade=s.nextDouble();

   }catch(Exception ex){

       return;}

}

}

Explanation:

Define a string variable named s_name and a double variable named grade. Obtain the name and grade from the user, then invoke the fun() method with these parameters, which will multiply the grade by 10 and output a message that includes the student's name along with their average grade.

Output:

Please enter the name:john

Please enter the grade point:3.2

john's average grade is $32.0

7 0
19 days ago
A computer can successfully ping outside the local network, but cannot access any world wide web services. what is the most prob
amid [805]
<span>Port 80 is being blocked by the Windows Firewall.</span>
7 0
1 month ago
Other questions:
  • 6. Write pseudo code that will perform the following. a) Read in 5 separate numbers. b) Calculate the average of the five number
    6·1 answer
  • In this project, you’ll create a security infrastructure design document for a fictional organization. The security services and
    9·1 answer
  • Some early computers protected the operating system by placing it in a memory partition that could not be modified by either the
    5·1 answer
  • Write a loop that reads strings from standard input, where the string is either duck or goose. the loop terminates when goose is
    7·1 answer
  • Which of the following best describes how computing devices represent information? A. A computer will either represent informati
    9·2 answers
  • PLEASE HELP!!~~
    7·1 answer
  • When a CPU executes instructions as it converts input into output, it does so with
    12·1 answer
  • 1. Orthographic Drawings are used to express ideas that are more complicated. Explain the purpose of the different views and the
    7·1 answer
  • Meadowdale Dairy Farm sells organic brown eggs to local customers. It charges $3.25 for a dozen eggs, or 45 cents for individual
    6·1 answer
  • Which of the following does not describe local alignment algorithm?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!