subject

We say a portfolio matches the benchmark when the market value percentage of each asset in the portfolio matches the market value percentage of each asset in the benchmark. Your challenge is to write a program that determines the transactions necessary to make a portfolio match a benchmark, assuming the total market value of the portfolio stays the same. BackgroundA portfolio is a collection of assets such as stocks and bonds. A portfolio could have 10 shares of Vodafone stock, 15 shares of Google stock and 15 shares of Microsoft bonds. A benchmark is also just a collection of assets. A benchmark could have 15 shares of Vodafone stock, 10 shares of Google stock and 15 shares of Microsoft bonds. The market value of a stock isshares * priceThe market value of a bond isshares * (price + accrued interest) * 0.01A transaction is when you "buy" or "sell" a particular asset. For instance, you can decide to buy 5 shares of Vodafone stock which, given the portfolio described above, would result in you having 15 shares of Vodafone stock. An asset’s market value percentage can be calculated by dividing the market value of the asset by the total market value of every asset in the portfolio or benchmark. For example, given the portfolio described above and assuming all assets have a price of 5 and accrued interest is 0.05, the market value percentage of Vodafone would be(10 * 5) / ( (10 * 5) + (15 * 5) + (15 * (5 + 0.05) * 0.01) )Inputs and OutputsYou will receive a string in the following format Portfolio:Benchmark where Portfolio & Benchmark each are in the same format. Here is the format: Name, AssetType, Shares, Price, AccruedInterest where each asset within Portfolio or Benchmark is separated by '|' symbol. The output for the transactions is TransactionType, Name, SharesAssumptionsShares & Price are positive decimalsThere will always be at least 1 asset present in the Portfolio and BenchmarkA particular asset will only be a stock or a bond, but not bothThe final trades should be rounded to the nearest decimalsThe trades should be sorted in ascending order based on the names of the assetsInput:Vodafone, STOCK,10,50,0|Google, STOCK,15,50,0|Microsoft, BOND,15,100,0.05:Vodafone, STOCK,15,50,0|Google, STOCK,10,50,0|Microsoft, BOND,15,100,0.05Output:BUY, Vodafone,5SELL, Google,5Test 1Test InputDownload Test InputGoogle, STOCK,10,50,0|Microsoft, STOCK,15,50,0|IBM, BOND,15,100,0.05:IBM, BOND,20,100,0.05|Google, STOCK,15,50,0|Microsoft, STOCK,10,50,0.05Expected OutputDownload Test OutputBUY, Google,5BUY, IBM,5SELL, Microsoft,5Test 2Test InputDownload Test InputVodafone, STOCK,10,50,0|Google, STOCK,15,50,0|Microsoft, BOND,15,100,0.05:Vodafone, STOCK,15,50,0|Google, STOCK,10,50,0|Microsoft, BOND,15,100,0.05Expected OutputDownload Test OutputSELL, Google,5BUY, Vodafone,5

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:00
The great length of north america causes the climate to be varied. true false
Answers: 2
question
Computers and Technology, 23.06.2019 04:31
Acloud service provider uses the internet to deliver a computing environment for developing, running, and managing software applications. which cloud service model does the provider offer? a. iaas b. caas c. maas d. paas e. saas
Answers: 1
question
Computers and Technology, 24.06.2019 04:30
Which of the following terms refers to a collection of different types of software that share the goal of infiltrating a computer and making it do something? a- malware b- virus c- spyware d- trojan horse
Answers: 2
question
Computers and Technology, 24.06.2019 20:00
Which element will you include to present numerical on a slide? a: graph b: text c: flowchart d: shapes
Answers: 1
You know the right answer?
We say a portfolio matches the benchmark when the market value percentage of each asset in the portf...
Questions
question
Mathematics, 01.02.2021 17:30
question
Mathematics, 01.02.2021 17:30
question
Social Studies, 01.02.2021 17:30
question
Social Studies, 01.02.2021 17:30
question
Chemistry, 01.02.2021 17:30
Questions on the website: 13722363