6.1 Quiz Instructions

Write a program that displays and counts the words in the following files. Save all of these files in your work folder.

Please note the first file (FileDoesNotExist.txt) does not ... you guessed it ... exist. Your program must deal gracefully with this case, i.e. not die with an unhandled exception. So, to be clear, you will NOT have a file named FileDoesNotExist.txt in your working folder.

Name your class "<your name>_FileQuiz" and submit the source code to me via DropItToMe

The program must produce the exact output found in: (make sure you use the output comparision tool!)

The program will process each file by:

  1. Printing out a dashed line separator
  2. If the file does not exist:
    • Display the line "<filename> does not exist!"
  3. If the file does exist:
    • Display the line "Stats for file <filename>:"
    • Display each word on a separate line preceeded by a tab
    • Display the line "There were <#> words found"
  4. Display a blank line

Quiz Grading

The quiz is worth 35 points.

This is pretty simple...you get 100% if your output exactly matches the expected output...and...0% if it has ANY differences.

Make sure you get all the spelling, capitalization, punctuation, spacing, etc. correct! Hint: copy-n-paste is a wonderful thing! :)