Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

create a new Java application called StringSlicer (without the quotation marks) that uses methods to: Get a String from the user at the command line

create a new Java application called "StringSlicer" (without the quotation marks) that uses methods to:

Get a String from the user at the command line

Populate an ArrayList of Character data (the wrapper class), with each char in the String represented as a separate Character element in the ArrayList

Output each Character to the command line, each on a separate line

Note:

Use an ArrayList where each element is a char. Declare the ArrayList in main.

The use of three methods is required.

The first method has no parameters and returns a string.

It prompts the user for a string and returns the string to main.

The prompt and read should be in the method (not main).

The second method has two parameters, the string from the first method and the ArrayList (which you are going to fill in). Use a for loop to go character by character through the string (charAt method).

Store each of the characters in the ArrayList using the add method.

The third method has the ArrayList as a parameter.

Use a for loop to printout each of the elements in the ArrayList using the get method.

An example run:

Enter a string:

rabbit

r

a

b

b

i

t

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_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions

Question

How are sedimentary rocks classified into types?

Answered: 1 week ago

Question

What are the different techniques used in decision making?

Answered: 1 week ago