Programming Assignment 2Monday, October 7
Statement of Work
|
||||
1.0 Overview | ||||
The National Association of Geeks (NAG) uses a special decoder for private messages. This program will demonstrate such a decoder using a special implementation of a stack as a linked structure. An encoded message will be parsed and decoded using the stack. | ||||
2.0 Requirements | ||||
The student shall define, develop, document, prototype,
test, and modify as required the software system. |
||||
2.1 This software system shall define a class, called
Decoder (Decoder.h and Decoder.cpp) which implements a stack as
defined in section 2.2. |
||||
2.2 The class shall contain functions as described below: |
||||
2.2.1 void Push(char ch) Dynamically create a structure of type StackNode
(see section 2.3), store the character in the structure and "Push" the structure onto
the stack. |
||||
2.2.2 char Pop() Remove (pop) the top node from the stack, copy the character,
from this node, delete the node and return the character. |
||||
2.2.3 void Decode(char *encMsg, char *decMsg) Parse and decode the message stored
in the character array encMsg using
the stack functions and return the decoded message in the character array decMsg.
Encoding of the string shall use the following format: |
||||
2.2.3.1 Command: 1l -- Character 1 (one) means Push the following
letter (l) onto the stack. |
||||
2.2.3.2 Command: 2n -- Pop n characters from the stack.
If the stack should become empty before the appropriate number of characters has
been popped then display a warning message to the user and terminate parsing
this message. |
||||
2.2.3.3 When the last encoded command has been executed then the Decode
function shall pop all
characters, one at a time, from the stack, place them in the decMsg array and
return the string to the caller. |
||||
2.3 This software system shall define a structure called StackNode, in the Decoder.h file, which can be used to implement a stack as a linked structure. The StackNode object shall contain a character field called ch and a pointer to the next StackNode object called next. | ||||
2.4 When started the program shall prompt the user to input an encoded
string which will then be decoded and the result printed on the screen. The
program shall continue to prompt the user for input until the user enters
the string "QUIT" at which time the program will terminate. |
||||
2.5 This program shall be capable of functioning either from keyboard
input or using I/O redirection and a text file containing encoded strings, one
per line. |
||||
3.0 Deliverables | ||||
These products, as specified below, shall be delivered to the instructor
electronically via e-mail. 3.1 Software Design Document -- The student shall provide a software design document for instructor approval NLT (Not Later Than) Tuesday, October 22. 3.2 Software Test Plan -- The student shall provide a test plan for complete verification and validation of the software for instructor approval NLT Tuesday, October 22. 3.3 Program source files -- The student shall provide fully tested copies of the .cpp and .h files. These files must be submitted to the instructor via e-mail. (NOTE: The main/test driver is now a deliverable of this product. ) The files shall be delivered NLT Wednesday, October 30. |
||||
4.0 Period of Performance | ||||
The period of performance of this assignment is 23 days from the date of assignment. No deliveries will be accepted after the DDD for this assignment. |