As the algorithm performs division of numbers with high precision,…

  

As the algorithm performs division of numbers with high precision,… As the algorithm performs division of numbers with high precision, it is very common to see really big numbers after the period (for example: 1200.2300001), which is not desirable because of several reasons:may cause confusion to some users when they see such big numbers;uses more memory to store a bigger number;it just does not make sense to display currency number in this format.For this reason, you are going to implement a utility function to format any number into the appropriate currency format, using 2 decimal places.For example: The number 1200.2300001 would be became: 1200.23  # global variable  def calculate_gains(amount_inv=0.0):    “”” Calculating the return gains of an investment.         # base amount gain margin    gain_margin=0.001    total_gains=0    total_amount=0          if amount_inv > 1000:         # check whether the invested amount is greater than the multiplier amount             # gather the value of the divisionmod=int(amount_inv/multiplier mod)             # update the `gain_margin` by the multiplier modgain_margin+=mod/100         # calculate the total amount of gainstotal_gains=gain_margin*amount_inv         # calculate the total amount plus the gain margin total_amount=amount_inv+total_gains     # return the gains, the full amount and the gain marginreturn (roundToThree(total_gains), roundToThree(total_amount), roundToThree(gain_margin))   Business Management Project Management BUS 110

Don't use plagiarized sources. Get Your Custom Essay on
As the algorithm performs division of numbers with high precision,…
Just from $13/Page
Order Essay
  

Leave a Reply

Your email address will not be published.

Related Post

Open chat
💬 Need help?
Hello 👋
Can we help you?