subject

First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ==> Close All Projects). Then create a new Java application called "StringSlicer" (without the quotation marks) that uses methods to:
1. Get a String from the user at the command line
2. Populate an ArrayList of Character data (the wrapper class), with each char in the String represented as a separate
Character element in the ArrayList
3. Output each Character to the command line, each on a separate line
NOTE: For this assignment and all future assignments that deal with methods, you should be calling the appropriate method to do the task indicated, rather than implementing the task logic in the main method itself.
One of the PA requirements is to use an ArrayList where each element is a char. There are several
implementation approaches. The notes below use an ArrayList and String variable locally declared in
main. The use of three methods is required for this PA.
Method 1: The first method has no parameters and returns a string. Within the method body, the user
should be prompted for a string and the string should be read into a local string variable using the next()
method. There’s no requirement for entering a multi-word phrase – so using the next() method is fine.
The user-entered string is then returned to main.
The header of the method should be similar to this:
public static String input()
Method 2: This method has two parameters, the string returned 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 (use of the
charAt method works well). Store each of the characters of the input string into the ArrayList using the
add() method.
The header of the method should be similar to this where ‘aString’ is the returned string from Method 1,
and charArray is the ArrayList declared in main.
public static void process(String aString, ArrayList charArray)
Method 3 has the ArrayList as a parameter. The method uses a for loop to printout each of the elements
in the ArrayList using the get method.
The method header should look similar to this:
public static void output(ArrayList charArray)
An approach for implementing main, pseudocode:
Declare local ArrayList
Declare local String variable
Call ‘input’ method which no parameters and returns a String
Call ‘process’ method which has the String and the ArrayList as parameters
Call ‘output’ method which has the ArrayList as a parameter
An example run:
Enter a string:
rabbit
r
a
b
b
i
t

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 01:30
Negative methods of behavior correction include all but this: sarcasm verbal abuse setting an example for proper behavior humiliation
Answers: 1
question
Computers and Technology, 23.06.2019 16:00
Write a grading program for a class with the following grading policies: a. there are two quizzes, each graded on the basis of 10 points. b. there is one midterm exam and one final exam, each graded on the basis of 100 points. c. the final exam counts for 50% of the grade, the midterm counts for 25%, and the two quizzes together count for a total of 25%. (do not forget to normalize the quiz scores. they should be converted to a percentage before they are averaged in.) any grade of 90 or more is an a, any grade of 80 or more (but less than 90) is a b, any grade of 70 or more (but less than 80) is a c, any grade of 60 or more (but less than 70) is a d, and any grade below 60 is an f. the program will read in the student’s scores and output the student’s record, which consists of two quiz and two exam scores as well as the student’s average numeric score for the entire course and final letter grade. define and use a structure for the student reco
Answers: 2
question
Computers and Technology, 23.06.2019 23:30
Match the following errors with their definitions. a. #name b. #value c. #ref d. 1. when a formula produces output that is too lengthy to fit in the spreadsheet cell 2. when you enter an invalid cell reference in a formula 3. when you type text in cells that accept numeric data 4. when you type in a cell reference that doesn’t exist
Answers: 1
question
Computers and Technology, 24.06.2019 07:50
Write a defining table and then a program that determines if you can sleep in or not. your program should get all its input from your computer’s clock. on all weekdays (monday through friday) that are not holidays, your program should output “get up! ” on all other days (weekends and holidays), your program should output “sleep in.” the three holidays that your program must check for are january 1 (new year’s day), july 4 (u.s. independence day), and december 25 (christmas). you don’t need to include other holidays in your program because most other holidays do not occur on a fixed day each year.
Answers: 1
You know the right answer?
First, launch NetBeans and close any previous projects that may be open (at the top menu go to File...
Questions
question
Arts, 13.12.2021 20:20
question
Mathematics, 13.12.2021 20:20
question
Mathematics, 13.12.2021 20:20
question
Mathematics, 13.12.2021 20:20
question
Health, 13.12.2021 20:20
question
Mathematics, 13.12.2021 20:20
Questions on the website: 13722361