Question: Please help me with question 1 (a). This is a Java coding question. Thank you. Directions: SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE

Please help me with question 1 (a). This is a Java coding question. Thank you.

Please help me with question 1 (a). This is a Java codingquestion. Thank you. Directions: SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS

ARE TO BE WRITTEN IN JAVA. Notes: Assume that the classes listed

Directions: SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA. Notes: Assume that the classes listed in the Java Quick Reference have been imported where appropriate. Unless otherwise noted in the question, assume that parameters in method calls are not null and that methods are called only when their preconditions are satisfied. In writing solutions for each question, you may use any of the accessible methods that are listed in classes defined in that question. Writing significant amounts of code that can be replaced by a call to one of these methods will not receive full credit. 1. Consider the following partial declaration for a WordScrambler class. The constructor for the WordScrambler class takes an even-length array of String objects and initializes the instance variable scrambledWords. public class WordScrambler { private String[] scrambledwords; * /** @param wordArr an array of String objects Precondition: wordArr.length is even */ public Wordscrambler (String[] wordArr) { scrambledWords = mixedWords (wordArr); } * /** @param wordi a String of characters @param word2 a String characters @return a String that contains the first half of word1 and the second half of word2 */ private String recombine(String wordi, String word2) { /* to be implemented in part (a) */ } * /** @param words an array of String objects Precondition: words.length is even @return an array of String objects created by recombining pairs of strings in array words Postcondition: the length of the returned array is words.length */ private String[] mixedWords (String[] words) { /* to be implemented in part (b) */ } * 1/ There may be instance variables, constructors, and methods that are not shown. } (a) Write the WordScrambler method recombine. This method returns a String created from its two String parameters as follows. take the first half of wordi take the second half of word2 concatenate the two halves and return the new string. For example, the following table shows some results of calling recombine. Note that if a word has an odd number of letters, the second half of the word contains the extra letter. wordi word2 recombine (wordi, word2) "apple" "pear" "apar" "pear" "apple" "peple" Complete method recombine below. /** @param wordi a String of characters @param word2 a String of characters @return a String that contains the first half of wordl and the second half of word2 */ private String recombine (String wordi, String word2)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!