[previous_group] [previous] [up] * [next_group]

Extending the Program Again

We now have a program to compute the profit for a one stock portfolio. The remaining feature we must add to meet the spec is to handle multiple stocks in the portfolio.

Suppose we have a two stock portfolio. What would the algorithm look like?

        Get the number of shares for the first stock
        Get the selling price for the first stock
        Get the purchase price for the first stock
        Print the data values for the first stock
        Compute the cost for the first stock
        Compute the value for the first stock
        Get the number of shares for the second stock
       Get the selling price for the second stock
       Get the purchase price for the second stock
       Print the data values for the second stock
       Compute the cost for the second stock
       Compute the value for the second stock
        Compute the profit
        Print the result

Will this work?


[up] to Overview.

[next_group]