CSC 111: Introduction to Computer Science

HW 10: Classes and More Classes, with HTML

Due Wednesday April 20 Midnight, via Moodle

SUBMIT as HW10.py


Write a Table of FriendInfo to Your Webpage

Think about all you can do with your new knowledge and skills! You could: So much information is posted on the web, and now you can get it automatically (with some work, of course).

(a) Overview

Back to what we've been working on... The homework this week is to create a table on your webpage that has FriendInfo data that has been retrieved from the Smith Directory. The final program you sumit should read in a text file called "NamesList.txt" that has a list of last names, and creates an html table with the name, phone number and email for each person.

(b) Homework Details

The details (not in any particular order) for this program are:

(c) Smith Directory Details

You will need to be careful about the capitalization of the name as it is used in the base URL. As you search through the page source to retrieve your desired information, try searching both for occurrences of the name all in lower case, as well as names that are capitalized. You might find useful tags with one form and not the other. For the name that you include in your table, print it out as first name and then last name. For example, if "cardell" were to be in the input file, then the final HTML table should have (with or without the middle initial):

Name Phone email
Judith Cardell 585-4222 jcardell@smith.edu

For the phone number, feel free to use the "(413)" as a tag, and then you could, or not, include that in your table.

Finally, for the email, you could either obtain it from the webpage, as you are the other information, or you could actually construct it yourself using Python's string processing.

(d) What to Sumbit

Submit a program that expects no user input. Instead, your program will read in a list of last names from a text file, called NamesList.txt, and the names could have any capitalization in this file. (This means that you will want to do something to make them all lowercase, if that is how you need to use them in the base URL, for example.) Your program will create a webpage (.html file) that has basic elements, such as your name. This webpage will also have a table of information retrieved from the Smith Directory.

You can retain any other elements from previous assginments, or make this a simple page with just your name(s) and a beautiful table.

If you do retain other elements, include any "user_input" information in your file directly - don't require any user input from me. I will still have a generic jpeg file though, so if you want to include images, just be sure to change the name of all the expected jpeg files to "HW10image.jpg" before you submit your program. Therefore, you can assume that I will have a directory. That directory will contain:

It will not contain anything else, until I run your program. When I run your program, it will create a HW10.html file that I can view.

That's it for this week - two class definitions creating two types of objects, with the data that you retrieve being compiled into a list of objects and then displayed in an HTML table.

A sample solution program can be viewed here.