November 2013
Beginner
325 pages
9h 47m
English
This challenge builds on the challenge from the previous chapter.
Create a subclass of BNRStockHolding called BNRForeignStockHolding. Give BNRForeignStockHolding an additional property: conversionRate, which will be a float. (The conversion rate is what you need to multiply the local price by to get a price in US dollars. Assume the purchasePrice and currentPrice are in the local currency.) Override costInDollars and valueInDollars to do the right thing.
In main(), add a few instances of BNRForeignStockHolding to your array.
Figure 20.6 BNRStockHolding and BNRForeignStockHolding objects
Read now
Unlock full access