View the step-by-step solution to:

Question

please help! i want to know how to do it without using try-catch loop

alt="EBD0F72B-06C2-4DD7-82C7-D39153CEC3BC.jpeg" />

EBD0F72B-06C2-4DD7-82C7-D39153CEC3BC.jpeg

Write a Java application, Lab09.java, that reads the text file, input.txt (found on Canvas at Assignment/Lab09 -
see note below!), and creates an output file named, output.txt, by doing the following tasks:
1) Reverse the case of all letters so that all lower-case letters in input.txt will show up in output. txt as upper-case,
all upper-case letters in input. txt will show up in output.txt as lower-case.
2) All numbers/digits will show up as a hyphen-separated list of the words for the digits in that number. Some
examples: the number 123 in input. txt will show up in output.txt as one-two-three; the number 7 in input.txt will
show up in output.txt as seven. Notice that the hyphens (dashes) are placed between the names of the digits, but
not before or a after the value being displayed. For example, there is no hyphen before the word, one, in "one-
two-three" and no hyphen after the word, three. See the example input file and output file results below.
3) output.txt should end up with the same number of lines as in input.txt.
As lines are written to the output file, output.txt, they should also be displayed to the console for the user to see.
Note about the input file: The input file available on Canvas is an example that your program should be able to
process. However, your program should be able to process any text file applying the three rules above to every
character on every line of any text file the user may select. So, a good idea would be to create your own versions
of input.txt for testing your program to the fullest possible extent.
Here is A TEXT
123 File To Be
hERE IS a text
Processed FOR Lab09.
one-two-three fILE to be
There are now 3459 ways to
PROCESSED for lABzero-nine.
DESIGN this kind of PROGRAM.
THERE ARE NOW three-four-five-nine WAYS TO
Here's hoping you can figure OUT 1, 2
design THIS KIND OF program.
or 3 of these designs -
hERE'S HOPING YOU CAN FIGURE out one, two
Or AT LEAST come close, even if
OR three OF THESE DESIGNS -
you don't find all 3459
OR at least COME CLOSE, EVEN IF
YOU DON'T FIND ALL three-four-five-nine
input.txt - An Example Input File
Correct Output File Contents for Example on left

Top Answer

Try catch statement : Try-catch are used to handle exceptions(unexpected errors). When reading a file or writing to a file,... View the full answer

lab09Output.png

javac Lab09 . java
java Lab09
hERE IS a text
one-two-three fILE to be
PROCESSED for 1ABzero-nine.
THERE ARE NOW three-four-five-nine WAYS to
design THIS KIND OF program.
hERE'S HOPING YOU CAN...

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question