Question: Problem Definition In this assignment, you will be completing the bulletin board you began in PROGRAM 3. We will be adding two major new functionalities:
Problem Definition
In this assignment, you will be completing the bulletin board you began in PROGRAM 3.
We will be adding two major new functionalities:
The bulletin board will now be able to handle replies to replies, and will display them indented according to their "level" (e.g. Replies are indented 2 spaces; Replies to Replies 4 spaces; Replies to Replies to Replies 6 spaces; etc.) You will use recursive techniques to display this.
The board will now be able to save the entire board (all Message content) to file, and read that file back in; as well as reading in User data from file as you did with the previous bulletin board assignment.
Class Specifications
https://docs.google.com/document/d/1EfkX-GxzvQarHfDbABHhY-_hcqiHkLarLR1bEUSg4y4/edit
Main function that should be used for the compare output tests. As before, you should create a very different main function when unit testing your member functions.
https://docs.google.com/document/d/1-geawPiVfnFWBzosl2rfqBSDQEYRcexegKBpX7rLXkc/edit
Message File Specifications
The format specifications of the Message file:
https://docs.google.com/document/d/1NKmmuc7Yd_VV-XDk896h3C1s12JOznWvgkW3kg_BRT8/edit
sample Message file you can use when testing your loadMessages function and overall program:
https://docs.google.com/document/d/1IXqm7IdNPvzqobh1kC7N5CSnXSPgrnvvcFXTE5e6qOQ/edit
Output Specifications
Sample output:
https://docs.google.com/document/d/1GWQJ7rJ5WwOWEWnvQUTXJtbPbo5LUtBPIf9PWCoHckA/edit
Make sure your output matches exactly with the sample runs (given the same inputs) - in particular, note the differences between Topics and Replies.
Step-by-step Approach
Incremental Programming is essential with a project this size.
Copy your work from BBoard (Part 1) assignment.
Message File Read:
Read from a simple file that has only a single Topic, and add the pointer to it to messageList in loadMessages.
Now read from another simple file that has only one Topic and one Reply to that topic, and add it to messageList in loadMessages, and add a pointer to the Reply to the Topic's childList.
Now read in a file with multiple Topics and Replies (you will need a loop, of course!!)
Message File Write:
Build the toFormattedString() function in Reply (Dont forget newline after ). Test it by calling function and outputting the string it returns.
Build the toFormattedString() function in Topic. Test it.
In BBoard::saveMessages() call toFormattedString() on each Message in messageList and print the returning strings to screen/terminal for debugging.
Finally, print the strings to the file instead of the terminal.
Nested Replies and Display:
Modify Message.h, Topic.h and Reply.h files as specified
Modify the print function in Message.cpp to call itself recursively on each of its children after printing the topic itself
In BBoard, modify display and addReply functions as specified.
Have your program run correctly with nested replies
Hints and Tips
Reading from file:
Be very careful assigning "children" (Replies)!!! The children Messages will not be in memory when you are reading the parent, due to their order in the file. One way of doing this would be: For each Message (whether Topic or Reply), maintain a separate string vector that stores the strings following the ":children:" tag (e.g., "5 6 21"). When you finish populating the messageList (or after you close the file), parse the strings (see hint below), construct the Reply objects, and store their POINTERS. e.g.
messageList[i].addChild(messageList[child-1]);
for each element (child) in the corresponding string. Make sure you add an empty string to any string vector with no :children: tag.
Using stringstream to parse message files:
Review the stringstream section! (Section 8.6)
void parseForChildren(vector&childList, const string &filename) { ifstream infile(filename); string discard; int childID; string childIdString; // discard and :children: infile >> discard >> discard; // WARNING: this function is just a HINT - in your actual program you // will need to know when you are dealing with a reply or a topic getline(infile, childIdString); // get string containing all child ids stringstream iss(childIdString); while (iss >> childID) { childList.push_back(childID); } }
MY BBOARD ASSIGNMENT TO USE THIS ASSIGNMENT IS BASED OFF:
https://drive.google.com/drive/folders/0B_A3v2K0_5HyZVVJdTVhbFM4ZXc?usp=sharing
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
