Answered step by step
Verified Expert Solution
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 mobydicktxt: MOBY DICK; OR THE WHALE
by Herman Melville CHAPTER
Loomings.
Output Text File: sgnimooL
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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started