Computer Science 202
Programming Assignment 1
Assigned: January 16, 1998
Due: January 30, 1998
I'm sure that all of you have used the World-Wide Web. Web pages are written
in a language called HTML (Hyper Text Markup Language). Your programming
assignment lets you work with simple HTML files. Display a main menu of
options from which the user may select again and again in any order. If the
user doesn't select a correct option, make the user select again.
The options are as follows:
1. Display how a given HTML file would look in some form of browser. The
HTML file will consist of zero or more ordered and/or unordered lists. When
this option is selected, ask the user for two file names: an input file
containing the HTML commands, and an output file where the formatted text will
be stored. The
and
tags are used to open and close ordered
(numbered) lists, and the tags are used to open and close
unordered lists.
2. Given an indented input file, produce the HTML file
corresponding to the file. When this option is selected, ask the user
for two file names: an input file, and an output file where the HTML output
will be stored.
Samples of input and output files for each option are given below.
Part 1:
Sample HTML file:
- This
- is
- assignment
- of
- the semester.
Output:
1. This
2. is
* the
* first
3. assignment
1. of
2. the semester.
If the input file is not valid HTML (i.e., a list is not terminated
correctly, there are too many tags, or tags don't match up properly),
give the user an error message indicating which line of the file caused the
problem.
Part 2:
Given an indented text file, produce an HTML file which will give
a similar effect. The first line of the file contains a number indicating
the number of spaces in an indentation unit.
Sample Input File:
3
This
is
the
first
assignment
of
the semester.
Output: