Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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... 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

Data Analysis And Decision Making

Authors: Christian Albright, Wayne Winston, Christopher Zappe

4th Edition

538476125, 978-0538476126

More Books

Students also viewed these Programming questions