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, 23.06.2019 03:00
What are the different parts of computer
Answers: 2
question
Computers and Technology, 23.06.2019 07:00
Why were most movies from the late 1890s until the early 1930s only filmed in black and white? there were only a few people who could afford the technology to produce color motion pictures back then. audiences did not want color motion pictures until later. the film used to make color motion pictures often overheated, which was a safety hazard, so it was generally not allowed. color films had to be hand-colored, frame by frame.
Answers: 3
question
Computers and Technology, 23.06.2019 21:40
language consists of basic components, and they are called a. 3; mental images, concepts, and speech b. 2; language acquisition and linguistic relativity c. 3; heuristics, algorithms, and analogies d. 4; phonemes, morphemes, syntax, and semantics e. 2; words and grammar
Answers: 3
question
Computers and Technology, 23.06.2019 22:30
Janice usually works on a particular workbook that contains all business related data. she decides to keep a backup of all the data in a separate workbook. she opens a new workbook to transfer the data. which option should she use to copy all the data from one workbook to another workbook?
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
Health, 17.10.2019 08:00
question
Mathematics, 17.10.2019 08:00
question
Mathematics, 17.10.2019 08:00
Questions on the website: 13722360