Assignment 5 Solution

$35.00 $30.80

Description

Microproject

Write a Python program which takes a single argument — a directory name. Your program will, for every file in the directory, count the number of lines in that file using the Unix command wc. Then, write to the console each file name and its number of lines.

Main Project

Write a Python program that collects, summarizes, and e-mails all the programming assignments for this course. Specifically, assuming the programs are in subdirectories a1, a2, …, a5 of directory csc344, your program should:

  • create a summary_ai.html file for each ai, which contains (in reasonably formatted, valid HTML):
    • the name of each source file (linked to the file itself), along with the number of lines long the file is, and
    • a list of all identifiers used in the program (class, function, rule, variable etc. names), omitting duplicates. You do NOTneed to specially filter keywords or builtin functions;
  • create a valid HTML web page in the csc344 directory called index.html with links to each of the summary files;
  • create a zip file containing all assignment sources, but excluding non-sources (executables, .class files, etc). Also included should be the html files created above. Be sure the links in the webpages work after extracted;
  • prompt the user for an email address and send the zip file.

An Important Note…

You should run your project on altair and send mail from your @cs.oswego.edu account. You can send mail from the command line using the mailx command. You may also need uuencode which you can copy from pi to your home directory.

I will not actively stop you from using your gmail account with app specific passwords, but note that gmail is generally unhappy sending some kinds of source files inside zips. A successful demo will involve sending the email and me receiving it, extracting it, and being able to view your pages/code following the links on your page.

Extra Credit

There are several opportunities for extra credit on this assignment, such as generating XML or JSON files instead of HTML, and displaying them using XSLT or JavaScript, respectively. If you’re interested, let me know and we can discuss further.

Dev Environment / Useful Resources

PyCharm
Regular Expressions in Python 3.6
Regular Expression Debugger / Tester