CMSC 160 -- Lab 12

Lab 12

Download your lab file

  1. Use wget to download the file at http://cs.longwood.edu/courses/cmsc160/f17/files/lab12.tgz
  2. Uncompress the lab12.tgz file by using tar -xvzf lab12.tgz
  3. Use ls to see that there is a new directory called lab12
  4. Use cd lab12 to change directory to the lab12 directory

The Problem

We will be using scalable vector graphics (SVG) files in this lab. SVG files are text files which can be displayed as graphics when viewed in a web browser.

In your lab12 directory is a subdirectory of .map files. These files contain svg shapes for each county and city in the commonwealth of Virginia. There is a text file in the subdirectory called index.txt. This file contains the file name for each .map file in the directory. You need to open each file and write its' contents to a single output file named virginia.svg. You will surround each .map file with a starting <g fill="rgb(128,128,128)" stroke="rgb(0,0,0)" stroke-width="24"> and a closing </g>.

Each time you run your program you will want to copy your virginia.svg to your public_html directory. You can do this with the following command:
make copy

The virginia subdirectory also contains a text file named census2010.txt this file contains US census data for each county (and city) in Virginia. Each line contains the county name, the population, and percentages of the population for different age groups. The groups are [0-15] [15-30] [30-45] [45-60] [60+]. You will color (change the fill="rgb..." listed above) each county based on the age percentages. The red component should be [0-30], the green [30-60], and the blue[60+]. In addition you will add a title line for each county displaying the percentages as well as the county name.

Your output should look something like this.

Handin

Your completed lab is due on Nov. 21th at 11:59pm. It should be handed in by using the make handin command.