Computer Science 202
Introduction to Programming
Fall 2012, The College of Saint Rose
For this short lab assignment, your job is to write a program to read in the words from a file, and for all words longer than 4 characters, to print them out along with their lengths.
You will develop and submit only a Java program for this lab.
You may work alone or with a partner on this lab.
Program Requirements
Your program should do the following:
Bonus Opportunity
For 3 points of bonus, use a method to check the length and (for words longer than 4 characters) print out the word and its length.
Style and Documentation Reminders
Before you submit your programs, make sure they conform to our guidelines for style and documentation.
In particular, you should have a comment at the top of each class that describes your program and has your name (and that of your partner if you are working with someone), the course number and section (02 for 11:15, E1 for 4:10). You should have comments throughout your programs describing your variables and any non-obvious Java statements or groups of statements.
All identifiers (class names and variable names) should be meaningful and conform to Java's naming conventions.
Your code should be nicely formatted, with new lines after any
{
or }
, and indented as done in class examples.
Submitting Your Work
Before 11:59 PM, Tuesday, November 13, 2012, submit your Java program to Blackboard for grading. Please upload your Java source file (LongWords.java - upload the one with the .java file extension, not the .class, .ctxt, package.bluej or README files).
Grading
This assignment is worth 20 points, which are distributed as follows:
> Feature | Value | Score |
Read input file name | 2 | |
Create Scanner for input file | 2 | |
Loop to read each word from input file | 3 | |
Ignore words 4 characters or shorter | 2 | |
Print word and length for words longer than 4 characters | 3 | |
Using correct filename | 1 | |
Comments | 2 | |
Naming conventions | 3 | |
Formatting | 2 | |
Using a method (bonus) | 3 | |
Total | 20 | |