Purpose:
A BillOfMaterialsFactory object can be used
to create the bill of materials that is involved in the manufacture
a particular array of products.
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.
BillOfMaterialsFactory and related classes
are being designed and implemented for a small company called
The Clip, LLC.
The Clip manufacturers a variety of products:
| Product Name | Item Number |
| Clipboard | 0 |
| Bag_Clip | 1 |
| Refrigerator_Clip | 2 |
| Door_Clip | 3 |
| Message_Board | 4 |
| Door_Closer | 5 |
They also manufacture a variety of assemblies:
| Assembly Name | Item Number |
| Clip_Assembly | 6 |
| Clip_Front | 7 |
| Clip_Back | 8 |
| Door_Mount | 9 |
They manufacture these products and assemblies from the following raw materials:
| Raw Material | Item Number |
| Rivet | 10 |
| Sheet_Metal | 11 |
| Spring | 12 |
| Magnet | 13 |
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).
/**
* 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);
/** * 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.)
string class
that is in the <string> library (instead of a
char[]). You should familiarize
yourself with it before you start doing anything else.
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.
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.)
BillOfMaterialsFactory:
Copyright 2010