Question: For java NAV is the Net Assets Valuation which is the value of the total assets held in a portfolio. Often the portfolio managers try

For java

NAV is the Net Assets Valuation which is the value of the total assets held in a portfolio. Often the portfolio managers try to track a certain benchmark portfolio in terms of the percentage weight of the assets. For instance, consider a portfolio PORT with 3 assets and a benchmark portfolio BENCH with 3 assets:

 PORT BENCH Stock Qty Price Stock Qty Price AXN 10 10 AXN 50 10 BGT 20 30 BGT 30 30 CXZ 10 30 DFG 30 20 

The percentage Nav in stock A for PORT can be calculated as follows:

Nav(PORT) = (Qty(AXN) * Price(AXN))+(Qty(BGT) * Price(BGT))+(Qty(CXZ) * Price(CXZ)) %Nav = (Qty(AXN) * Price(AXN)) * 100 / Nav(PORT) 

A Portfolio is said to be overweight in a stock if its %Nav in that stock is larger than the %Nav in the stock in the Benchmark. Alternately, it is underweight in a stock if its %Nav in a stock is less than the benchmark.

Write a program to calculate the difference in the %Nav of the holdings in the PORT and the BENCH.

Sort the portfolios in alphabetical order and display the difference upto 2 decimal points.

For example:

The program must be able to take this input exactly as shown here.

Input:

PORT:AXN,10,10;BGT,20,30;CXZ,10,30|BENCH:AXN,50,10;BGT,30,30;DFG,30,20

Output:

AXN:-15.0,BGT:15.0,CXZ:30.0,DFG:-30.0

Input:

PORT:AXN,0,10;BGT,20,30;CXZ,10,30|BENCH:AXN,50,10;BGT,30,30;DFG,30,20;XYZ,0,10

Output:

AXN:-25.00,BGT:21.67,CXZ:33.33,DFG:-30.00,XYZ:-0.00

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!