IUP Computer Science
COSC 310   Spring 2008

Project #1
(Ordering Parts)
(Due  23 Jan 08  and  1 Feb 08)

Wood Stuff Inc. sells wood furniture accessories (shelves, bookcases, entertainment centers, cupboards, etc.), usually wholesale to low-cost housing contractors and commercial outlets.  It is a small business with a very limited inventory of parts and a small stock of products on hand.  The company accountant wants to determine how many components of various types it needs to order to fill all of the orders that it currently has.

The component inventory listing is held in the file, inventory.txt.  Each line of this file contains the specification for one of the parts used in one or more of Wood Stuff Inc.'s products.  There are fewer than 100 different parts.  The specifications have colons separating each field (data item) from the next and are in the following form:

Part-No:Description:Supplier:Cost-per-part:Quantity-on-hand:Minimum-quantity-allowed

Here are the first few components to give you an example.  The part number is a 5-digit number; the description may contain several words; the supplier is a company name; the cost per part is measured in dollars and cents and is used to determine the cost and price of products WSI makes; the quantity on hand and the minimum quantity allowed are integers.  The last value represents the point at which more parts need to be ordered - when the quantity on hand dips below it.

10244:felt bumper pads:Soft Stuff Inc.:0.02:8510:2500
10398:screw covers:Soft Stuff Inc.:0.01:4535:3000
18560:3/4" cam bolt:Acme Co.:0.14:2430:500

The stock listing is held in the file, products.txt.  Each line of this file contains specifications about the parts which go into one product.  There are fewer than 100 products.  The specifications have colons separating each field (data item) from the next as follows:

Model-No:Description:Quantity-on-hand:Aggregate-labor:needed:part-no:needed:part-no: . . .

Here are a couple of examples of products.  The model number is a 4-digit number; the description may contain several words; the quantity on hand is an integer; the aggregate labor is often a floating point number; the "needed" for a part may be an integer or floating point number; the part-no is a 5-digit number that refers to a part in the inventory file.  The aggregate labor is the number of collective work hours required to produce the product.  The product may have any number of needed:part-no pairs to specify product components.

5406:maple shelves:48:1.6:0.5:36701:0.5:36720:2:33124:18:40805:12:40802:1:22204
5408:oak shelves:37:1.5:0.5:36702:0.5:36712:24:41092:24:10398:1:22204
5440:plain shelves:52:1.4:1:36702:24:38023:1:22204

Customer orders are collected in the file named   orders.txt  Each line of it has the form

Customer-Name:Model-No-Ordered:Quantity-Ordered

Here are a couple examples, showing Trader Horn orders for 15 4-shelf bookcases (model 5211) and 10 oak storage units (model 5149)

Trader Horn:5211:15
Trader Horn:5149:10

You are to write a program that reads the three files and produces a report showing for each inventory part that is an element of some ordered product what the status is for that part.  Copy the three data files from   I:\jlwolfe\310\s08  For each product that is ordered, the inventory must be reduced by the parts needed to construct that product.  If the number of elements on hand for a particular part drops below the minimum for that element, more of this element must be purchased.  If the number on hand will be less than the minimum, your program must indicate that more parts must be purchased, stating how many and the cost of those parts.  If the number on hand is greater than or equal to the miminum, all that needs to be done is to reduce the number on hand.  When ordering more parts, the program must order enough to meet the orders and leave twice the mimimum on hand.  Here is a sample.

Part Description          OnHand  Minimum    Needed  Purchase     Cost  Remaining
felt bumper pads            8510     2500   2440.00                          6070
screw covers                4535     3000  11880.00     13345   133.45
3/4" cam bolt               2430      500   1898.00                           532

For felt bumper pads and 3/4" cam bolts, the number needed to fulfill the orders will leave more than the minimum - this is identified under Remaining.  For screw covers, more are needed than can be satisfied from the on hand parts; so, 13345 need to be purchased at a cost of 0.01 each; the cost will be $133.45.  Note here that the number shown as "Needed" represents the parts needed to fulfill all orders; it is shown as a floating point value because some parts are used in pieces.  If some fractional number, such as 53.25, need to be purchased, your report should show an order for 54 because none of the parts can be purchased in fractions.

You are required to do this project in two stages.

In the first stage, you must hand in a UML class diagram showing how you intend to construct the program.  The class diagram must conform to the description given in class and the UML handout and show each class you intend to use, its instance variables and methods.  It must also show the associations between the classes needed to perform the task.  The UML diagram is due on  23 Jan 08.

In the second stage, you must hand in a printout of your well documented program and the output that it generates (the revenue report).  You must create a folder named p1 under the folder named after you on the P: drive for COSC 310.  Copy into the p1 folder all .java files that you created for this project.  If you have placed the .java files in a package, copy the entire package to the p1 folder.  The program is due on 1 Feb 08.

Note:  The files and the classes that you design for this project are used in project #2.  So, you should construct your design and program so that additional tasks can be added to it.