CS 374 HW3: Design Theory
James Madison University, Spring 2022

Electronic submission due Feb 13th before 11:59 PM.
Each student submits hw3.tex and classes.py via Canvas.

Textbook Exercises

Answer the questions in the provided LaTeX template below. The details for each question are in the textbook, but the LaTeX template includes additional instructions.

Download hw3.tex or clone/edit on Overleaf

If you are unfamiliar with LaTeX, see the Overleaf Documentation.

Python Exercise

The purpose of this last exercise is to give you experience using Python to reformat data so that it can be imported into a database. Consider the following scenario. When you search for classes on MyMadison, they are displayed graphically as multiple HTML tables. Here is a PDF of all the undergrad CS classes offered in Fall 2021. Your task is to convert this data into CSV format. Here is a plain text version of the PDF, which I created by "selecting all" and copying/pasting into a text editor.

Write a Python script named classes.py that opens and reads the classes.txt file and outputs the data in CSV format. Here is a classes.csv file that shows what the final result should look like. Each section of each class should be on a separate line, with the required fields separated by commas. Use classes.csv as a reference—your output must match the contents of this this file exactly!

Your program should print all output to the screen. If you want to save the output to a file (e.g., to Meld the contents with the provided classes.csv) you can redirect standard output to a file like this:

python3 classes.py > output.csv
meld classes.csv output.csv

Notice the last page of the LaTeX template inputs your classes.py file. That way, I will be able to grade your code in the same PDF as the rest of your homework. I will also run your code (offline) to make sure it works correctly. Good luck!

Honor Code Statement

This assignment must be completed individually. Your submission must conform to the JMU Honor Code. Authorized help is limited to general discussion on Discord, asking questions during class, and meeting with the instructor. Copying work from another student or the Internet is an honor code violation and will be grounds for a reduced or failing grade in the course.