Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Midterm-2

Points-100

Due-05/09/2023

You have been tasked to write inventory and sales software for a chicken farm (Doolittle Farms). Chicks arrive from the hatchery in different size lots that have an initial per chick price. Chicks are sold to customers in a last-in-first-out basis. Customer orders are processed in a first-in-first-out basis. As chicks age in the warehouse, they become more valuable so the price per chick increases by 0.10 per day. Orders can be split between lots with different chick prices but, remember; chicks are still sold on a last-in-first-out basis. If an order comes in and there are not enough chicks to fill the order, then no chicks are sold until sufficient supply arrives from the hatchery (i.e. customer orders are queued up).

Very General Algorithm:

Set current day number equal to zero.

While there is more input:

Read an input record from the input file.

Update current day number using days info in the record.

If it is a shipment from the hatchery

Add shipment to the stack.

If it is an order

Add the order to the queue.

Process as many orders as possible from the queue using current stock.

Output summary information

Input:

The input file will consist of records detailing customer orders and hatchery shipments. Customer Order Record

O, Customer Name (String), Number of Chicks (int), Number of days since last event (integer)
Ex. O, Bryant Poultry Farm, 100, 2

Hatchery Shipment Record

S, Number of chicks in the lot (int), price per chick (double), Num days since last event (int)

Ex. S, 200, 3.25, 0

The zero means that this event happened on the same day as the previous event.

Output:

Your output will show an aligned table with information about each customer sale followed by some summary information.

Customer Name1     # of chicks purchased    Ave Price/Chick    Total Amount

Customer Name2     # of chicks purchased    Ave Price/Chick    Total Amount

….

Customer NameN     # of chicks purchased    Ave Price/Chick     Total Amount

Summary Information

Total Number of Completed Sales:

Total Number of Chicks Sold:

Average price of each chick sold:

Average number of days a sold chick stayed in the warehouse:

Gross Sales Total:

Implementation Details:

Create ArrayList implementations of a Stack (chick inventory) and Queue (customer orders). You must build your own classes the implement standard Stack and Queue methods. The input and output file names will be provided using command-line arguments and your program should perform appropriate error checking and exception handling. Please refer to the coding guidelines for documentation style guidelines.

Submission: Zip and submit your entire project. Include a text file in your project root directory named README that describes what you think works correctly and incorrectly in your program. Also include any special instructions needed to test your program.

Some General Grading Facts:

· An undocumented/commented program will not receive a grade better than 75.

· A program that does not compile will receive a grade of zero.

· Create Stack and Queue classes and use good modular design for full credit.

· Make sure your output has a table with aligned columns.

· Work independently and do not share your code with other students.

· Have fun!!! After all, it’s coding!