1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Burka [1]
3 years ago
9

Write the method makeNames that creates and returns a String array of new names based on the method’s two parameter arrays, arra

y1 and array2. The method creates new names in the following fashion: for each String in array1, concatenate a String from array2. Add a character space between the two strings: array1[i] + " " + array2[j]
In the example below the array names contains 20 names including "David A", "David B", "David C", …, "Lucy E".

String[] first = { "David", "Mike", "Katie", "Lucy"};
String[] middle = {"A", "B", "C", "D", "E");
String[] names = makeNames (first, middle);

If one of the parameter arrays has size 0, return the other parameter array.
In the example below the array names contains 4 names: "David", "Mike", "Katie", "Lucy".

String[] first = {"David", "Mike", "Katie", "Lucy"};
String[] middle = {};
String[] names = makeNames (first, middle);

Use the method header: public static String[] makeNames (String[] array1, String[] array2)

Create a String array containing permutations of strings from two String array parameters.
Computers and Technology
1 answer:
Gwar [14]3 years ago
5 0

Answer:

  1. import java.util.Arrays;
  2. public class Main {
  3.    public static void main(String[] args) {
  4.        String [] first = {"David", "Mike", "Katie", "Lucy"};
  5.        String [] middle = {"A", "B", "C", "D"};
  6.        String [] names = makeNames(first, middle);
  7.        System.out.println(Arrays.toString(names));
  8.    }
  9.    public static String [] makeNames(String [] array1, String [] array2){
  10.           if(array1.length == 0){
  11.               return array1;
  12.           }
  13.           if(array2.length == 0){
  14.               return array2;
  15.           }
  16.           String [] newNames = new String[array1.length];
  17.           for(int i=0; i < array1.length; i++){
  18.               newNames[i] = array1[i] + " " + array2[i];
  19.           }
  20.           return newNames;
  21.    }
  22. }

Explanation:

The solution code is written in Java.

Firstly, create the makeNames method by following the method signature as required by the question (Line 12). Check if any one the input string array is with size 0, return the another string array (Line 14 - 20). Else, create a string array, newNames (Line 22). Use a for loop to repeatedly concatenate the string from array1 with a single space " " and followed with the string from array2 and set it as item of the newNames array (Line 24-26). Lastly, return the newNames array (Line 28).

In the main program create two string array, first and middle, and pass the two arrays to the makeNames methods as arguments (Line 5-6). The returned array is assigned to names array (Line 7). Display the names array to terminal (Line 9) and we shall get the sample output: [David A, Mike B, Katie C, Lucy D]

You might be interested in
Moore’s law describes the pace at which ______ improve.
iren2701 [21]

Answer: CPUs

Hope it helps :) and let me know if you want me to elaborate.

7 0
2 years ago
Suppose you've decided to write a function template that you expect to use in many different source files. Suppose, further, tha
Sladkaya [172]

Answer:

The Solution to the given question can be defined as follows:

Explanation:

Please find the complete question in the attachment file.

In this case, the compiler will try to correct the model type by both the form we used when we try and call the method with both the appropriate form variable. It type of function. Consequently, unless the function in another file is specified, the compiler cannot locate the digital strategy. The point to note here is that only when this code is used, the template code shall be compiled.

The construct component will therefore be efficient so in this case, its connection stage would fail. An undefined connection to the feature <function name> can constitute a possible error in this case. It rules, therefore, address the construction project problem. Furthermore, the template function throughout the main program is generally recommended. It can be solved alternatively because parameters of a template like <function name><type> could be specified throughout the CPP file.

8 0
2 years ago
File explorer provides ____ ways to view the contents of a folder.
AURORKA [14]
2 or 3 ways.......................................
5 0
3 years ago
What indicates a website of a university
ad-work [718]

Answer:

The domain suffix/TLD .edu is reserved for colleges and universities

Examples:

harvard.edu

stanford.edu

juilliard.edu

8 0
2 years ago
PARTNERING AS IT RELATES TO BPR.​
balandron [24]

Answer:

The answer to this question can be defined as follows:

Explanation:

The term BPR stands for "business processes reengineering", It is the recreating of the core business process to improve product performance or reliability or lower costs.

  • It generally includes analyzing business processes, which identifying sub-par or ineffective processes but identifying ways to dispose of or change it.
  • IT important for improving changes, especially to shift in aspects of the work, its incorporation in business operations, or competitive strength change.
  • It might contribute to making reconfiguration improvements, and is known as a BPR enabler.
6 0
3 years ago
Other questions:
  • Rachel works in a bank. She wants to present the idea of implementing an IS to the management. How should Rachel describe the IS
    9·2 answers
  • What is the car on the right?
    7·1 answer
  • Is printer an input device​
    5·1 answer
  • write an algorithm that gets the price for item A plus the quantity purchased. The algorithm prints the total cost, including a
    5·1 answer
  • A computer retail store has 15 personal computers in stock. A buyer wants to purchase 3 of them. Unknown to either the retail st
    14·1 answer
  • In Word, a red wavy underline indicates a/an
    15·1 answer
  • In networking, bandwidth is the volume of computer data carried via a conductor in a period of time. Which one of these could be
    11·1 answer
  • Why is Apple using social media ?
    15·1 answer
  • All of the following are helpful test taking strategies EXCEPT_______________.
    5·2 answers
  • What does the statement that follows do? double gallons[6] = { 12.75, 14.87 }; a. It assigns the two values in the initializatio
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!