This program must be done in JAVA. Write a program to monitor the flow of an...

70.2K

Verified Solution

Question

Programming

This program must be done in JAVA.

Write a program to monitor the flow of an item into an out of awarehouse. The warehouse has numerous deliveries and shipments forthis item (a widget) during the time period covered. A shipment out(an order) is billed at a profit of 50% over the cost of thewidget. Unfortunately each incoming shipment may have a differentcost associated with it. The accountants of the firm haveinstituted a last-in, first out system for filling orders. Thismeans that the newest widget are the first ones sent out to satisfyan order. This method of inventory can be represented by a stack.The Push procedure will insert an incoming shipment while a Popshould be called for a shipment out. Each data record in the textfile warehouse.txt will consist of one shipment per line withfields (separated by white space of) I or O (char) shipment comingIN or shipment going OUT # (integer) quantity of the shipment Cost(float) cost per widget of the shipment (Incoming only) Vendor(String) name of the company sending or receiving the shipmentWrite the necessary procedures to store the shipments received andto process the orders. The output for an order consists of thequantity and the total costs of the widget in the order. Eachwidget price is 50% higher than its cost. The widgets used to fillan order may come from multiple shipments with different costs. Ifthere are not sufficient widgets in inventory, use all theremaining and bill accordingly. When the simulation terminatesdisplay the total amount owed to each of the suppliers (incoming),the number of widgets on hand and the total profit.

Sample Input:

I 20 34.00 Fred’s Supply Company

I 30 25.00 Jumbo Exports

O 40 Acme Industries

Output:

Orders: Shipment to Acme Industries 40 units for $1635.00

Summary: Suppliers Fred’s Supply Company $680.00

Jumbo Exports $750.00

There are 10 widgets in the warehouse.

Profit is $545.00

Answer & Explanation Solved by verified expert
4.3 Ratings (558 Votes)
    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students