Question: In this assignment, you will be using a queue for storing data for FIFO accounting, and a stack for LIFO accounting. Implement your queue using
In this assignment, you will be using a queue for storing data for
FIFO accounting, and a stack for LIFO accounting. Implement
your queue using the java Queue class and implement your stack
using Java Stack class.
The stock Ticker symbol a string
The Stock Name a string
The number of shares of a stock an int
The purchase price for those shares decimal
You can assume that the first element of the structure is the security bought first,
the second was bought second, etc.
Your program should have the user able to enter information about various
stocks, the number of shares, and the price per share. The user can then enter a
query about a certain stock and the cost according to the LIFO and FIFO
accounting methods for a certain number of shares.
The following could be your menu:
Press to enter a new stock
Press to find the LIFO and FIFO dollar cost average for the number of shares
sold.
If is pressed, the user needs to enter the stock symbol, Stock name, the number
of shares bought, and the price per share when purchased.
If is pressed, the user needs to enter the stock symbol being queried and the
number of shares you wish to sell. Once that information is entered the dollar
cost averaged price per share for both the LIFO method and the FIFO method
should be displayed.
Implement the program described above using the Java programming language
to meet the overall requirements described above. Use the below data.
Ticker:XOM
Name:Exon Mobile
Purchases in the order below.
shares at
sharees at
shares at
shares at
Ticker:D
Name:Dominion Resources
Purchases in the order below.
shares at
shares at
shares at
shares at
Formula: Multiply shares of the stock by the purchase of those shares and divide by total shares of stock. Suppose a user wants to calculate for shares in Dominion Resources. To calculate for stackLIFO start from the top of teh stack you would and for queue FIFO start from the bottom of the stack you would
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
