Lines
CS 362 - Fall 2009 - Ms. Katz

Due: 5pm, Friday, September 4th     Worth: 50 points

Goals
- to remind yourself about writing programs
- to build a program on your own ............. This assignment may not be done in pairs. You must build it yourself.
- to understand a problem so that you understand the C++ version

Overview
You will write a program from scratch in an appropriate language. I expect you to use Java unless you don't know it. The program reads in many lines of input and after reading all of them, prints how many of them there were, how many characters were in the longest one, and then the lines in the same order in which they were input.

Throughout this course (and throughout your career) you should use an iterative enhancement approach to development. Understand the problem. Design a solution for part of the problem. Implement and test that. Evaluate what you did. Go back to the problem and solve a larger piece. By following this approach, you will always have a partial solution completed.

At the top of the program, include a summary comment briefly describing the program and giving your name and the month. Your program must use functions/methods. Each method should have a one-line comment describing what it does. Each method should be cohesive - it should do one thing well. You should use parameters rather than declaring data in your main method and using it everywhere. The Scanner for stdin may be a static class variable.

Try to break your program. Don't use only the one test case shown below.

Problem Specification
The user will enter lines of text from standard input. The program should not open files or ask for a filename. It should not prompt for input. There is no limit on line length or on the number of lines. Finish your input by typing control-D. You do not need to test for that character. It is the end of input and will signal to the scanner that there is no more data.

After all lines are read, the output is a report of the number of lines read as well as the number of characters in the longest line. The output should not indicate which line was the longest. There should be some sort of matching dividing lines around this report. The remainder of the output is the input lines printed one per line and in the same order in which they were input.

I expect you to use Java for this assignment if you know it. However, if you do not know Java, you may use another appropriate language as long as it is available on our CS server. Let me know if you plan to use something other than Java.

Submit the directory containing your solution as the Lines assignment. The main Java class should be named Lines.

Sample Input from User (type control-d to end standard input; control-z on Windows)

Declaration of Independence

We hold these truths to be self-evident,
that all men are created equal,
that they are endowed by their Creator with certain unalienable Rights,
that among these are Life,
Liberty
and the pursuit of Happiness.

Output from Program

=================================================
8 lines with the longest having 71 characters.
=================================================
Declaration of Independence

We hold these truths to be self-evident,
that all men are created equal,
that they are endowed by their Creator with certain unalienable Rights,
that among these are Life,
Liberty
and the pursuit of Happiness.