Last month Sally purchased some stock in ABC CO, Inc. Here are the details of the purchase:
the number of shares that Joe purchased was 1,000
When Joe purchased stock, he paid $32.87 per share
Joe paid his stockbroker a commission that amounted to 2% of the amount he paid for the stock.
Two weeks later Joe sold the stock. Here are the details of the sale:
the number of shares that joe sold was 1,000
He sold the stock for $33.92 per share.
He paid his stockbroker another commission that amounted to 2% of the amount he received for the stock.
Write a program that displays the following information:
the amount of money Joe paid for the stock.
the amount of commission Joe paid his broker when he bought the stock.
the amount that Joe sold the stock for.
the amount of commission Joe paid his broker when he sold the stock.
display the amount of profit that Joe made after selling his stock and paying the two commissions to his broker. (if the amount of profit that your program displays is a negative number, then Joe lost money on the transaction.)
Breaking it down
Define calculation methods
Set variables by calling calculation methods
Format ouput using number formatter
Modify the program to prompt the user to enter in number of shares, purchase price, selling price and broker rate
have fun by adding a particular message for profit. For instnace, if someone lost more than 15% in the sale of the stock, then display a message 'Rough day - want to come over for a beer?'. Vise versa, in the event they had a killer day > 20 %, display a message 'Where we going out for dinner!'
Include the % of gain or loss percentage similar message to profit, if a user is using a broker that has a commission rate of > X% 'hey you have heard of tdameritrade, right?'