Assigned Date: Friday, Feb. 13, 2015
Due Date: Friday, Feb. 20, 2015
Due Time: 12:20pm
Last modified on February 23, 2015, at 01:39 PM (see updates)
Write a program that reads in a file and calculates the number of lines, words, and characters contained. The program should accept a filename as input and then print three numbers showing the count of lines, words, and characters in the file. (This is the same as exercise 15, p. 121 of the textbook.)
Make sure your program is user-friendly, i.e., that it provides a meaningful input prompt and output message.
- To learn the fundamentals of procedural analysis and design.
- To learn the features of procedural programming: the major types of statements, such as assignment, repetition, and the major data types, such as integers, real numbers, and character strings.
If the user makes an error, output a meaningful error and terminate. If the input is correct, perform the calculations and output the result.
If you do the bonus, make sure you update the header documentation below to reflect that.
In general, you should comment any variable, obscure statement, block of code, etc. you create.
Additionally, your code should always have header documentation that explains what the program does, in general terms.
Follow the documentation instructions from Homework 1. In particular, you should modify these comments, to fit the new assignment.
You will submit your assignment via OAKS. Your submission consists of:
- Your Python program. Call it, wc.py.
- A printout of your program - to be submitted in class on the due date.
- If you do the bonus, submit a separate, additional program. Give this program a different name, i.e., wc.bonus.py
Your grade will be based on how well you followed the above instructions.