Introduction This program is meant to see how well a student can write a program starting from a (mostly) blank editor screen. It's also meant to see whether everyone is able to write a program that reads in text from a file as individual words, store those words in a data structure, and then perform some computations on that data structure. I assume that most will use Eclipse to create and run their programs. Because Eclipse insists on every program being in a package, create and place this program into a package called csc403. All of the programs you create this quarter will go into that package. There are several programs provided in the "Example programs" content module in D2L showing how to read data from a file. One of them shows how to fill a String array from a text file using the StdIn object and associated methods. Use that as a guide. Simple statistics on in a text file Write a program called WordSimpleStats that: 1. prints your name followed by three equal signs; 2. reads the words in a text file into a String array, where each array entry contains a word; 3. prints the number of words in the file; 4. computes and prints the average length of all of the words; keep in mind that an average is not an integer; 5. computes and prints the the length of the longest word; 6. counts and prints the number of seven-letter words; 7. counts and prints the number of words ending with a vowel (that is, 'a', 'e', 'i', 'o', or 'u'); Other requirements You must use the classes StdIn and stdout for input and output. Points will be deducted if this is not done. Use the data file tale.txt, which you will find in the data folder you downloaded as part of the instructions on how to set up Eclipse. In your program, specify the pathname data/tale.txt. Do not use a pathname specific to your computer. Only print what is specified above. When printing a value, don't simply print the value. Always provide explanatory text. For example, when printing the number of words in the file, print: Number of words in the file: 12345. Grading rubric The program is worth 26 points, broken down as follows: 4 for using StdIn and StdOut for input/output ⚫2 for creating and filling the array from the file correctly ⚫2 for printing the number of words ⚫4 for computing and printing the average length ⚫4 for printing the length of the longest word 4 for printing the number of seven-letter words 4 for printing the number of words ending with a vowel 2 for specifying the file pathname correctly Points may be deducted for not following the specifications above. For example, not having the program in the csc403 package. Points will be deducted if your name is not in a comment at the top of the program. A program that doesn't compile or that compiles and then crashes will be given o points. In this case, if you believe your program is supposed to compile and run, please make an appointment so that we can discuss the program. Keep in mind that, for any program, you may be required to meet with me to explain how your program works.
Introduction
This
There are several programs provided in the "Example programs" content module in D2L showing how to read data from a file. One of them shows how to fill a String array
from a text file using the StdIn object and associated methods. Use that as a guide.
Simple statistics on in a text file
Write a program called WordSimpleStats that:
1. prints your name followed by three equal signs;
2. reads the words in a text file into a String array, where each array entry contains a word;
3. prints the number of words in the file;
4. computes and prints the average length of all of the words; keep in mind that an average is not an integer;
5. computes and prints the the length of the longest word;
6. counts and prints the number of seven-letter words; 7. counts and prints the number of words ending with a vowel (that is, 'a', 'e', 'i', 'o', or 'u');
Other requirements
You must use the classes StdIn and stdout for input and output. Points will be deducted if this is not done.
Use the data file tale.txt, which you will find in the data folder you downloaded as part of the instructions on how to set up Eclipse. In your program, specify the pathname data/tale.txt. Do not use a pathname specific to your computer.
Only print what is specified above. When printing a value, don't simply print the value. Always provide explanatory text. For example, when printing the number of words in
the file, print:
Number of words in the file: 12345.
Grading rubric
The program is worth 26 points, broken down as follows:
4 for using StdIn and StdOut for input/output
⚫2 for creating and filling the array from the file correctly ⚫2 for printing the number of words
⚫4 for computing and printing the average length
⚫4 for printing the length of the longest word
4 for printing the number of seven-letter words
4 for printing the number of words ending with a vowel 2 for specifying the file pathname correctly
Points may be deducted for not following the specifications above. For example, not having the program in the csc403 package. Points will be deducted if your name is not in a comment at the top of the program. A program that doesn't compile or that compiles and then crashes will be given o points. In this case, if you believe your program is supposed to compile and run, please make an appointment so that we can discuss the program.
Keep in mind that, for any program, you may be required to meet with me to explain how your program works.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps