Lab 6 - Using input & output
files, Strings, Arrays, foreach & for
- For
this lab you will be asked to read a single line from a file whose name is
provided by the user.
- The
data in the file should be stored in a String.
- You
will be asked to output the characters in the String to the screen and to
a file whose name is provided by the user.
- The
characters are to be printed one per line preceded by a header statement
that you will be given.
- You
then need to convert your String to an array using the appropriate method
from the String class.
- You
then are to print the array to the screen and to the same file using the foreach statement described and
shown on pages 249, 251, and 384 of your text.
- The
array elements are to be printed on a single line.
- You
need to tell the user what the input and output file names are.
For this assignment, you are being given a java file
consisting only of comments. You need
to write the code described by the comments.
You may find it helpful to look at code from previous assignments.
java template