Answer:
The question is incomplete because the numbers are missing, so I looked for a similar question that can help you understand how this works.
Cost of goods sold under FIFO (first in, first out):
June 20 sale = 14 units x $15 = $210
Inventory on hand:
June 29 sale = (3 units x $15) + (5 units x $19) + (5 units x $23) = $255
Inventory on hand:
Total COGS = $465
Ending inventory = $138
Gross profit = ($518 + $481) - $465 = $534
Cost of goods sold under LIFO (last in, first out):
June 20 sale = (5 units x $19) + (9 units x $15) = $230
Inventory on hand:
June 29 sale = (11 units x $23) + (2 units x $15) = $283
Inventory on hand:
Total COGS = $513
Ending inventory = $90
Gross profit = ($518 + $481) - $513 = $486