subject

Write a public static method named insert. The insert method should have the signature insert(String[] words, String newWord, int place), should return a boolean, and should function as described below. When called, if place does not represent a valid index for words, then the method will return false to indicate the insertion could not be performed and do nothing else. Otherwise the method will insert the String newWord into the array words at the index place, moving each subsequent entry one place further and losing the final String in the array. The method will then return true to indicate the insertion has taken place.
Use the runner class to test this method: do not add a main method to your code in the U6_L4_Activity_One. java file or it will not be scored correctly.
Here is the runner code:
import java. util. Scanner;
public class runner_U6_L4_Activity_One{
public static void main(String[] args){
Scanner scan = new Scanner(System. in);
System. out. println("Enter array length:");
int len = scan. nextInt();
scan. nextLine();
String[] wordList = new String[len];
System. out. println("Enter values:");
for(int i = 0; i < len; i++){
wordList[i] = scan. nextLine();
}
System. out. println("Enter new String:");
String insWord = scan. nextLine();
System. out. println("Enter place:");
int pos = scan. nextInt();
System. out. println("Method return: " + U6_L4_Activity_One. insert(wordList, insWord, pos));
System. out. print("Array contents: {");
for(int i = 0; i < len-1; i++){
System. out. print(wordList[i] + ", ");
}
System. out. println(wordList[len-1]+"}");
}
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 13:30
Asoftware company hired ray, a college graduate to work in their development team. ray is assigned to work in the coding phase of a project. what happens during the coding phase of a software development project? a. the customer receives a working model of the software. b. developers convert the program design into code. c. developers gather requirements directly from the stakeholders. d. testing teams check the product for quality.
Answers: 1
question
Computers and Technology, 22.06.2019 18:30
Which of the following is an example of intellectual properly! oa. new version of a novelb. journal of ideasc. pages of a bookood. lines of a poem
Answers: 2
question
Computers and Technology, 23.06.2019 02:00
What is the main benefit of minimizing the ribbon in word? more options will be accessible through customized keystrokes. more of the document will be viewable without needing to scroll. fewer controls will be accessible to the user by using the mouse. fewer editing options will be available without entering a password.
Answers: 1
question
Computers and Technology, 23.06.2019 19:30
What are loans to a company or government for a set amount of time
Answers: 1
You know the right answer?
Write a public static method named insert. The insert method should have the signature insert(String...
Questions
question
Mathematics, 02.01.2020 01:31
question
Social Studies, 02.01.2020 01:31
question
Mathematics, 02.01.2020 01:31