In-Class Project

Class WordCount

Program Name: WordCount.java

Create a java class named WordCount counts the words in a file. See #1 under Programming Projects in your text. The program is going to count the number of words, lines, and total characters (not including white space) in the file. Assume that consecutive words are separated either by spaces or the end-of-line character.

Your program is going to have 2 methods:

Your main method should:

examineFile takes a file scanner object as a parameter. It should:

turnin: WordCount

Out-of-Class Projects

1. CompareFiles

Program Name: CompareFiles.java

SEE #2 Under Programming Projects in your text. Write a program that compares two files and prints out information about the differences between them. See the example in the text for the format of the output.

If there are no differences, print a message that there are no differences.

Your program should have 2 methods:

main method:

compareFiles: takes 2 Scanner file objects.

turnin CompareFiles

2. ReWrite

ReWrite.java

Modify the WordCount.java you wrote for the In-class project.

turnin: ReWrite


This page is maintained by Barbara Bracken Last Modified 8/5/2022