CIS 22 - Data Structures
Part II - HTML Displayer v. 2
In Assignment #1, you created a simple HTML displayer. In this assignment
you will use the Stack data structure to extend the displayer's
functionality in two different ways. Of course, all the functionality
from assignment 1 should still be present unless modified by this assignment.
This assignment should be done in C++.
1. Improved Syntax Checking
In Assignment 1, your displayer only made some very simple checks on the
syntax of the HTML files it was attempting to display. Use a Stack
to implement checks for mismatched tags. For example, HTML such as
<B>A new <I>world from </B> the ashes of the old</I>
should be determined to be incorrect. (Of course, browsers are
designed to minimize error messages, so most will display this in
a way that may or may not have been intended by the author.) When
your displayer detects such an error, it should display the page up to
the point of the error, then issue an error message. This message
should be as helpful as possible to an author who wants to correct the
error. As in assignment 1, tags other than <A>, <BR>, and <P>
should not affect the display, even though your displayer will be analyzing
the occurrence of these tags.
Several tags are not used as begin/end pairs, so your displayer
should not give errors for those tags. In particular, your displayer
should be "aware" of the <P>, <BR>, <HR>, and <LI> tags.
Note that your displayer will only detect at most one such error per
2. The "Back" Button
In assignment 1, your user interface allowed the user 3 navigational choices:
choose a link number, choose a file, or display the next page of the current
file. For this assignment, use a Stack to implement the
option of "going back" to previously displayed files. Your displayer
should have a "memory" of at least the previous 10 files. If at any
point it is not possible to go back ( because the earliest remembered page
is being displayed), the "go back" option should not be offered to the
Implement a "Forward" option, in a manner similar to the "Back" option.
When it is not possible to go forward, the choice should not be offered to
Your program must be thoroughly tested. An incomplete test will result
in the assignment being returned for resubmission. You can only resubmit
once-after that the assignment will no longer be accepted, so be sure you
perform thorough tests the first time.
Your tests should include (but not be limited to) the following cases:
You may have to run your program several times in order to test all cases.
tags that are not closed (for example a < B > without a < /B > ),
closing tags that do not match an opening tag,
improper nesting of tags,
going back one page,
going back several pages,
going back as many pages as
What to Submit
I do not want to look at your output on the screen. Dump the screen output,
print it and submit a hardcopy. Also submit all of your input source files.
(You do not need to submit the files you downloaded from here.) Obviously,
submit all the program and header files.
Annotate your submission by hand to indicate the various test cases.
For example, write on the output "this shows what happens if a closing
tag is missing"