Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this assignment, you will write a Java program that opens an input text file, manipulates the contents by reversing the order of lines, words

For this assignment, you will write a Java program that opens an input text file, manipulates the contents by reversing the order of lines, words within each line, and letters within each word, and writes the updated contents to a new output file.
Specifications:
The program should accept two command line arguments:
Input file name
Output file name
Use ArrayList to load contents and manipulate ordering
Reverse line order
For each line, reverse word order
For each word, reverse letter order
Write fully manipulated output to new file
Example:
Input Text File (mobydick.txt): MOBY DICK; OR THE WHALE
by Herman Melville CHAPTER 1
Loomings.
Output Text File: .sgnimooL
1 RETPAHC ellivleM namreH yb ELAHW EHT RO ; KCID YBOM
Make sure to include:
Import statements
Main method signature with command line args
Descriptive comments and method headers
This program challenges you to leverage ArrayList methods to logically traverse contents and reorder in multiple ways. The layered reversals build complexity. Think through the intended flow before coding.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions