underline
Category: Line-Based File Processing
Author: Stuart Reges
Book Chapter: 6.3
Problem: underline
Write a static method called
underline that takes a Scanner containing an input file as a parameter and
that prints to System.out the same text with certain lines underlined. The
lines to be underlined all begin with a period. The period should not be
printed. You should print the text that follows the period on a line by
itself followed by a line of dashes equal in length to the text that follows
the period. For example, consider the following input:
.Statement of Purpose
I didn't expect to major in computer science until I took cse142.
I liked it more than I expected and that got me hooked on cs.
.High School Performance
I got very good grades in high school, graduating in the top 10% of
my class.
.College Performance
I have done well in my college classes, with an overall gpa of 3.5.
If the text above is stored in a Scanner called input and we make this call:
underline(input);
the method should print the following output to System.out:
Statement of Purpose
--------------------
I didn't expect to major in computer science until I took cse142.
I liked it more than I expected and that got me hooked on cs.
High School Performance
-----------------------
I got very good grades in high school, graduating in the top 10% of
my class.
College Performance
-------------------
I have done well in my college classes, with an overall gpa of 3.5.
Notice that some of the input lines can be blank lines.