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

1 Expert Approved Answer
Step: 1 Unlock

HERE IS YOUR CODE import required packages import javautil public class Main public s... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!