Design/project10.txt
.edu.INSTITUTION.USERNAME.hotj.project10
.edu.INSTITUTION.USERNAME.hotj.project10
package.Your instructor will assign you one of the problems below. To solve your problem, write a program that reads the necessary information to compute and output the indicated values, as efficiently as possible. Following the pattern in the lab exercise, first, design using OCD. Then code your design in Java using stepwise translation. Test your program thoroughly.
When executing your program to hand in as part of the project, a JUnit test case should test each method at least five times, but the test case itself needs to be executed just once. A driver program should be run at least five times with different inputs each time.
Project #10.1: Write a program that reads from a file of real numbers, and displays the minimum, maximum, average, and range of the numbers in the file. The user should be able to enter the name of the input file from the keyboard.
Project #10.2: Write a program that reads the contents of a file and creates an exact copy of the file, except that each line is numbered. For example, if the input file contains the following text:
'Twas brillig, and the slithy toves Did gyre and gimble in the wabe; All mimsy were the borogoves, And the mome raths outgrabe. - Lewis CarrollThen the output file should appear something like this:
1: 'Twas brillig, and the slithy toves 2: Did gyre and gimble in the wabe; 3: All mimsy were the borogoves, 4: And the mome raths outgrabe. 5: - Lewis CarrollThe user should specify the names of the input and output files in command-line arguments.
Project #10.3: Write a text-analysis program that reads an essay or composition stored in a text file, and determines the number of words, the number of sentences, the average number of words per sentence, the average number of letters per word, and a complexity rating, using:
complexity = 0.5 * averageSentenceLength + 0.5 * averageWordLength.Based on these calculations, your program should assess the writing level of the essay as:
- Grammar School, if complexity < 6.
- Junior High, if 6 <= complexity < 7.
- High School, if 7 <= Complexity < 8.
- College, if 8 <= complexity < 9.
- Graduate, if complexity >= 9.
The user should supply the name of a file in command-line argument.
Turn the following things:
Lab Home Page | Prelab Questions | Lab Exercise | Homework Projects