233k views
5 votes
Write a program that caiculates the gains/losses generated by a stock investment after buying and selling shares on the stock market through the iTrade online broker platform. The program should prompt the user for: a) Company name and symbol. b) Number of shares transacted. c) Cost per share at the time of buying. d) Price (market value) per share at the time of selling.

User Shrutee
by
7.4k points

1 Answer

4 votes

Final answer:

A program can be written to calculate the gains/losses generated by a stock investment using the given information.

Step-by-step explanation:

A program can be written to calculate the gains/losses generated by a stock investment using the given information. The program should prompt the user for the company name and symbol, number of shares transacted, cost per share at the time of buying, and price per share at the time of selling. The program can then calculate the net profit by subtracting the total cost of buying from the total revenue from selling. The net profit can be displayed to the user.

User Vlad Papko
by
7.9k points