JMU
BillOfMaterialsFactory


Introduction

Purpose: A BillOfMaterialsFactory object can be used to create the bill of materials that is involved in the manufacture a particular array of products.

Definitions:

Product: A final product (i.e., a product that is sold to customers).

Assembly: An intermediat assembly (i.e., a manufactured part of a final product) used in the production process.

Material: A raw material used to manufacture either an intermediate assembly or a final product.

Bill of Materials: The number of products/assemblies/materials involved in the manufacture of a particular set of products/assemblies/materials.

Background
Existing Components
Several classes required by the BillOfMaterialsFactory have already been implemented, including a BillOfMaterials class:

BillOfMaterials ( Header , Implementation )

and a ProductsReader class:

ProductsReader ( Header , Implementation )

The purpose of the former should be obvious. The purpose of the latter is to: read the names of the various products/assemblies/materials from a file, read the units of measurement for the various products/assemblies/materials from a file, and read the production requirements for the various products/assemblies/materials from a file.

These files already exist:

All three files contain one "line" for each product/assembly/ material (ordered by item number). The file inputs.txt also contains one column for each product/assembly/material. "Line" 0 of inputs.txt is:

  0  0  0  0  0  0  1  0  0  0   4 100   0   0
  

This "line" can be interpreted as follows: One clipboard (item number 0) is manufactured from 1 clip assembly (column 6), 4 rivets (column 10), and 100 square inches of sheet metal (column 11).

The BillOfMaterialsFactory Class:
Explicit Value Constructor: This class must have a public explicit value constructor with the following signature:
/**
 * Explicit Value Constructor
 *
 * @param products   The number of final products in a BOM
 * @param assemblies The number of intermediate assemblies in a BOM
 * @param materials  The number of raw materials in a BOM
 * @param names      An array of product, assembly, and material names
 * @param units      An array of product, assembly, and material units
 * @param inputs     A two-dimensional array of the input requirements
 */
BillOfMaterialsFactory::BillOfMaterialsFactory(int products, 
                                               int assemblies, 
                                               int materials,
                                               string *names, 
                                               string *units,
                                               int  **inputs);
  
The createBillOfMaterials Method: This class must have a public method with the following signature:
/**
 * Create a BillOfMaterials for a given array of desired outputs
 * (which includes final products, intermediate assemblies, 
 * and raw materials)
 *
 * @param outputs  An array containing the desired number of each item
 */
BillOfMaterials *BillOfMaterialsFactory::createBillOfMaterials(int *outputs)
  

This method, or the method that it calls to actually do the work, must use recursion to create the BillOfMaterials. (Note: A "trivial" use of recursion will not satisfy this requirement.)

Other Methods: This class may have other methods, though they must be private.
Some Advice:
Strings: For this assignment you will need to use the string class that is in the <string> library (instead of a char[]). You should familiarize yourself with it before you start doing anything else.
Two-Dimensional Arrays: For this assignment you will need to use two-dimensional arrays (i.e., arrays of arrays). You should refresh your memory about two-dimensional arrays and pointers to pointers before you start doing anything else.
A Development Strategy: Your implementation of the BillOfMaterialsFactory should be quite short. You should spend most of your time thinking about how to write a recursive algorithm for creating a bill of materials.
An Example: Using the file inputs.txt you should be able to convince yourself that the bill of materials for 1 clipboard is: 1 clipboard, 1 clip assembly, 1 clip front, 1 clip back, 6 rivets, 120 square inches of sheet metal and 1 spring. (Note that a bill of materials contains some "double counting". Obviously, one doesn't really need a clipboard to make a clipboard. Also, the clip assembly consists of a clip front, clip back and some rivets. The bill of materials is intended to show all of the products, assemblies and materials involved in the process.)
Testing: A skeleton of a driver exists that you can modify to test your BillOfMaterialsFactory:

Copyright 2010