Question
Modify the program for Line Numbers from L09: In-Class Assignment. Mainly, you are changing the problem from using arrays to Array Lists. There are some
Modify the program for Line Numbers from L09: In-Class Assignment. Mainly, you are changing the problem from using arrays to Array Lists. There are some other modifications as well, so read the instructions carefully.
The program should do the following:
–Ask the user for how many lines of text they wish to enter
–Declare and initialize an **ArrayList** of Strings to hold the user’s input
–Use a do-while loop to prompt for and read the Strings (lines of text) from the user
at the command line until they enter a sentinel value
–After the Strings have been read, use a for loop to step through the ArrayList of
Strings and concatenate a number to the beginning of each line eg:
This is change to 1 This is
The first day change to 2 The first day
and so on…
–Finally, use a **for each** loop to output the Strings (numbered lines) to the command
line.
*/
Step by Step Solution
3.41 Rating (151 Votes )
There are 3 Steps involved in it
Step: 1
HERE IS YOUR CODE import required packages import javautil public class Main public s...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 StartedRecommended Textbook for
Data Analysis And Decision Making
Authors: Christian Albright, Wayne Winston, Christopher Zappe
4th Edition
538476125, 978-0538476126
Students also viewed these Programming questions
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
View Answer in SolutionInn App