not able to modify portfoliomanagerfactory to accomodate stockquoteservice. i easily implemented factory pattern in stockquoteservicefactory, invested a lot of time in portfoliomanagerfactory but am confused about instantiation of classes.

You just have to do the following steps.

  • Create a new Instance of stockquoteservicefactory.
  • Use the above instance to call getService() and store the result in stockquoteservice object.
  • After that create PortfolioManagerImpl object and pass the stockquoteservice object as a parameter in it.
  • Return PortfolioManagerImpl object.

Closing this topic as your issue is resolved by the mentor. If it is still not resolved, Kindly un-mark the accepted solution or create a new topic and post this question as a reference link in the description of the new topic.