Suppose, you are working in a company 'X' where your job is to calculate the profit based on their investment. If the company invests 100,000 USD or less, their profit will be based on 75,000 USD as first 25,000 USD goes to set up the business in the first place. For the first 100,000 USD, the profit margin is low: 4.5%. Therefore, for every 100 dollar they spend, they get a profit of 4.5 dollar. For an investment greater than 100,000 USD, for the first 100,000 USD (actually on 75,000 USD as 25,000 is the setup cost), the profit margin is 4.5% where for the rest, it goes up to 8%. For example, if they invest 250,000 USD, they will get an 8% profit for the 150,000 USD. In addition, from the rest 100,000 USD, 25,000 is the setup cost and there will be a 4.5% profit on the rest 75,000. Investment will always be greater or equal to 25,000 and multiple of 100.

Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter23: Simulation With The Excel Add-in @risk
Section23.4: Reliability And Warranty Modeling
Problem 4P
icon
Related questions
Question

Write down only the methods that are required; testers are not required

class FinalQ:
def print (self, array,idx):
if(idx<len (array)):
profit = self.calcProfit(array[idx])
#TO DO
def calcProfit(self,investment) :
#TO DO
#Tester
array=[25000,100000,250000,350000]
f = FinalQ()
f.print (array,0)
Output:
1. Investment: 25000; Profit: 0.0
2. Investment: 100000; Profit: 3375.0
3. Investment: 250000; Profit: 15375.0
4. Investment: 350000; Profit: 23375. 0
Transcribed Image Text:class FinalQ: def print (self, array,idx): if(idx<len (array)): profit = self.calcProfit(array[idx]) #TO DO def calcProfit(self,investment) : #TO DO #Tester array=[25000,100000,250000,350000] f = FinalQ() f.print (array,0) Output: 1. Investment: 25000; Profit: 0.0 2. Investment: 100000; Profit: 3375.0 3. Investment: 250000; Profit: 15375.0 4. Investment: 350000; Profit: 23375. 0
Suppose, you are working in a company 'X' where your job is to calculate the profit based
on their investment.
If the company invests 100,000 USD or less, their profit will be based on 75,000 USD as
first 25,000 USD goes to set up the business in the first place. For the first 100,000 USD,
the profit margin is low: 4.5%. Therefore, for every 100 dollar they spend, they get a profit
of 4.5 dollar.
For an investment greater than 100,000 USD, for the first 100,000 USD (actually on 75,000
USD as 25,000 is the setup cost), the profit margin is 4.5% where for the rest, it goes up to
8%. For example, if they invest 250,000 USD, they will get an 8% profit for the 150,000
USD. In addition, from the rest 100,000 USD, 25,000 is the setup cost and there will be a
4.5% profit on the rest 75,000. Investment will always be greater or equal to 25,000 and
multiple of 100.
Complete the RECURSIVE methods below that take an array of integers (investments)
and an iterator (always sets to ZERO(*0') when the method is initially called) and prints
the profit for the corresponding investment. You must avoid loop and multiplication (**')
operator.
Transcribed Image Text:Suppose, you are working in a company 'X' where your job is to calculate the profit based on their investment. If the company invests 100,000 USD or less, their profit will be based on 75,000 USD as first 25,000 USD goes to set up the business in the first place. For the first 100,000 USD, the profit margin is low: 4.5%. Therefore, for every 100 dollar they spend, they get a profit of 4.5 dollar. For an investment greater than 100,000 USD, for the first 100,000 USD (actually on 75,000 USD as 25,000 is the setup cost), the profit margin is 4.5% where for the rest, it goes up to 8%. For example, if they invest 250,000 USD, they will get an 8% profit for the 150,000 USD. In addition, from the rest 100,000 USD, 25,000 is the setup cost and there will be a 4.5% profit on the rest 75,000. Investment will always be greater or equal to 25,000 and multiple of 100. Complete the RECURSIVE methods below that take an array of integers (investments) and an iterator (always sets to ZERO(*0') when the method is initially called) and prints the profit for the corresponding investment. You must avoid loop and multiplication (**') operator.
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Function Calling
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage