Companies and people often buy and sells stocks. Often they buy the same stock for different
prices at different times. Say a person owns 1000 shares a certain stock (such as Checkpoint), she
may have bought the stock in amounts of 100 shares over 10 different times with 10 different
prices.
In this assignment, you will be using a stack for LIFO accounting. You should use an array
based implementation for your stack based implementation or a linked list for implementing your
stack. Your stack should have records with the following fields:
➢ The name of the stock (a string or int)
➢ The number of shares of a stock (an int)
➢ The purchase price (can be a decimal)
You can assume that the first element of the structure is the security bought first, the second
was bought second, etc.
Create a program that should have the user able to enter information about various stocks, the
amount of shares, and the price. The user can then enter a query about a certain stock and the
cost according to the LIFO accounting methods for a certain number of shares.
The following could be your menu:
➢ Press 1 to enter a new stock.
➢ Press 2 to find the LIFO price for a stock.
➢ If 1 is pressed, the user needs to enter the stock symbol, and the number of shares, and
the price.
➢ If 2 is pressed, the user needs to enter the stock symbol being queried and the number of
shares
Answers
Answered by
0
Answer:
the contraction of the present is recorded as the recorder is the fill in the blanks of stock price
Similar questions