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 1 to enter a new stock
Press 2 to find the LIFO and FIFO dollar cost average for the number of shares
sold.
If 1 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 2 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.
100 shares at 92.65
50 sharees at 97.23
200 shares at 84.50
100 shares at 86.58
Ticker:D
Name:Dominion Resources
Purchases in the order below.
350 shares at 64.98
200 shares at 66.72
100 shares at 69.00
180 shares at 67.90
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 550 shares in Dominion Resources. To calculate for stack(LIFO, start from the top of teh stack) you would (350(64.98)+200(66.72))/500 and for queue (FIFO, start from the bottom of the stack) you would (180(67.90)+200(66.72)+70(64.98))/550
In this assignment, you will be using a queue for

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!