1.0 Overview
The Book Worm, a privately owned business dealing in a variety of books and periodicals is in need of a program
that will store inventory records on books and periodicals and provide ready access to the information. This
statement of work addresses the first phase of this project. That is to develop and test an appropriate record data
structure.
2.0 Requirements
The student shall define, develop, document, prototype, test, and modify as required the software system.
2.1 This software system shall consist of one source file (.cpp) and one header file (.h) defining a C++ class which
can be used to store information on books and/or periodicals.
2.2 The header file, which shall be named BookRecord.h, shall define a C++ class. The source file, which shall
be named BookRecord.cpp, shall implement all functions of the class.
2.2.1 The class shall contain the following private variables: (1) a character array called m_sName, (2) a long
called m_lStockNum, (3) an integer called m_iClassification, (4) a double called m_dCost, and (5) an integer
called m_iCount. Details of these variables are defined below.
2.2.1.1 m_sName--This character array shall be 128 bytes in length and will be used to store the name of a
book or periodical.
2.2.1.2 m_lStockNum--This long shall be used to store a unique stock number for the book or periodical.
This will be used as the key in any store, search, or retrieval operation.
2.2.1.3 m_iClassification--This integer will be used to code specific information about the book or
periodical.
2.2.1.4 m_dCost--This double will be used to store the cost of this book or periodical.
2.2.1.5 m_iCount--This integer will be used to store the number of copies of this item currently in the
inventory.
2.2.2 The class shall contain the following public functions: a constructor and destructor and get and set
functions for each of the variables. These functions shall work as described in the following paragraphs.
2.2.2.1 BookRecord()--The default constructor shall set the member variables to the following initial values:
m_sName = "", m_lStockNum = 0, m_iClassification = 0, m_dCost = 0.0, and m_iCount = 0.
2.2.2.2 BookRecord(char *name, long sn, int cl, double cost)--This constructor shall set the member
variables to the values passed into the function and initialize the m_iCount variable to one (1).
2.2.2.3 ~BookRecord()--The destructor shall be an empty, place-holder function.
2.2.2.4 void getName(char *name), void setName(char *name)--The getName() function shall be defined
as a pointer function. A call to this function will copy the member variable m_sName into the character array
pointed to by the function argument. The setName() function will copy the function argument into the member
variable m_sName.
2.2.2.5 long getStockNum(), void setStockNum(long sn)--The getStockNum() function shall return the
value stored in the member variable m_lStockNum. The setStockNum() function will copy the function argument
into the member variable m_lStockNum.
2.2.2.6 void getClassification(int& cl), void setClassification(int cl)--The getClassification() function shall
be defined as a reference function. A call to this function will copy the member variable m_iClassification into the
interger variable referenced by the function argument. The setClassification() function will copy the function
argument into the member variable m_iClassification.CS 221 – Data Structures with C++ Fall 2014 Dr. Harry S. Delugach
2.2.2.7 double getCost(), void setCost(double c)--The getCost() function shall return the value stored in the
m_dCost member variable. The setCost() function will copy the function argument into the member variable
m_dCost.
2.2.2.8 int getNumberInStock(), void setNumberInStock(int count)--The getNumberInStock() function
shall return the value stored in the member variable m_iCount. The setNumberInStock() function will copy the
function argument into the member variable m_iCount.
2.2.2.9 void printRecord()--This function shall print to the screen all data found in the record. Data should
all be printed on a single line.
1.0 Overview
The Book Worm, a privately owned business dealing in a variety of books and periodicals is in need of a program
that will store inventory records on books and periodicals and provide ready access to the information. This
statement of work addresses the first phase of this project. That is to develop and test an appropriate record data
structure.
2.0 Requirements
The student shall define, develop, document, prototype, test, and modify as required the software system.
2.1 This software system shall consist of one source file (.cpp) and one header file (.h) defining a C++ class which
can be used to store information on books and/or periodicals.
2.2 The header file, which shall be named BookRecord.h, shall define a C++ class. The source file, which shall
be named BookRecord.cpp, shall implement all functions of the class.
2.2.1 The class shall contain the following private variables: (1) a character array called m_sName, (2) a long
called m_lStockNum, (3) an integer called m_iClassification, (4) a double called m_dCost, and (5) an integer
called m_iCount. Details of these variables are defined below.
2.2.1.1 m_sName--This character array shall be 128 bytes in length and will be used to store the name of a
book or periodical.
2.2.1.2 m_lStockNum--This long shall be used to store a unique stock number for the book or periodical.
This will be used as the key in any store, search, or retrieval operation.
2.2.1.3 m_iClassification--This integer will be used to code specific information about the book or
periodical.
2.2.1.4 m_dCost--This double will be used to store the cost of this book or periodical.
2.2.1.5 m_iCount--This integer will be used to store the number of copies of this item currently in the
inventory.
2.2.2 The class shall contain the following public functions: a constructor and destructor and get and set
functions for each of the variables. These functions shall work as described in the following paragraphs.
2.2.2.1 BookRecord()--The default constructor shall set the member variables to the following initial values:
m_sName = "", m_lStockNum = 0, m_iClassification = 0, m_dCost = 0.0, and m_iCount = 0.
2.2.2.2 BookRecord(char *name, long sn, int cl, double cost)--This constructor shall set the member
variables to the values passed into the function and initialize the m_iCount variable to one (1).
2.2.2.3 ~BookRecord()--The destructor shall be an empty, place-holder function.
2.2.2.4 void getName(char *name), void setName(char *name)--The getName() function shall be defined
as a pointer function. A call to this function will copy the member variable m_sName into the character array
pointed to by the function argument. The setName() function will copy the function argument into the member
variable m_sName.
2.2.2.5 long getStockNum(), void setStockNum(long sn)--The getStockNum() function shall return the
value stored in the member variable m_lStockNum. The setStockNum() function will copy the function argument
into the member variable m_lStockNum.
2.2.2.6 void getClassification(int& cl), void setClassification(int cl)--The getClassification() function shall
be defined as a reference function. A call to this function will copy the member variable m_iClassification into the
interger variable referenced by the function argument. The setClassification() function will copy the function
argument into the member variable m_iClassification.CS 221 – Data Structures with C++ Fall 2014 Dr. Harry S. Delugach
2.2.2.7 double getCost(), void setCost(double c)--The getCost() function shall return the value stored in the
m_dCost member variable. The setCost() function will copy the function argument into the member variable
m_dCost.
2.2.2.8 int getNumberInStock(), void setNumberInStock(int count)--The getNumberInStock() function
shall return the value stored in the member variable m_iCount. The setNumberInStock() function will copy the
function argument into the member variable m_iCount.
2.2.2.9 void printRecord()--This function shall print to the screen all data found in the record. Data should
all be printed on a single line.