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
14<br> Select the correct answer.<br> Which activity is a marketing technique?
Alex Ar [27]

Answer:

Growth Hacking.

Referral Programs.

Earned Media and PR.

Networking Events.

Search Engine Marketing.

Account Based Marketing and Retargeting.

Social Media Marketing.

Search Engine Optimization.

Explanation:

Growth Hacking.

Referral Programs.

Earned Media and PR.

Networking Events.

Search Engine Marketing.

Account Based Marketing and Retargeting.

Social Media Marketing.

Search Engine Optimization.

7 0
3 years ago
Which is the purpose of adding B-Roll footage to a sequence?
pav-90 [236]

Answer:

To add richness in content – B-roll footage is used to increase the depth of the main footage and improve storytelling.

Explanation:

Hope this helps

7 0
3 years ago
Jeffrey works with a huge database of spreadsheet records each day. To organize and identify these spreadsheets, he wants to ass
Reika [66]

Answer:

File details is the correct answer for PLATO users

8 0
2 years ago
Read 2 more answers
In total, how many 8-bit registers are there in the Intel 80x86 CPU design presented in class? Name one of these 8-bit registers
RSB [31]

Answer:

In general the number of  bit registers in Intel 80x86 CPU design when combined together forms a 16 - bit register

An example of the  -bit registers are AH, AL, BH, BL, CH, CL, DH, and DL

Explanation:

Solution

The 8086 CPU design has a total of eight 8-bit registers and these register can be integrated together to make 16- bit register as well.

The 16-bit data is stored by breaking the data into a low-order byte and high order byte.

The name of the 8 bit registers is shown below:

AH, AL, BH, BL, CH, CL, DH, and DL

7 0
2 years ago
Which of the following is true about a hot site?
swat32

Answer:

Option(d) is the correct answer to the given question.

Explanation:

A hot site is a place off site in which the task of a corporation could restart during a massive failure.The hot site seems to have all the needed equipment for such the corporation to schedule the normal activities, such as phone jacks, replacement data, laptops, and linked devices.

  • The main objective of hot sites provide an useful backup mechanism for any corporation that wishes to pursue its business in the presence of exceptional circumstances or events.
  • All the others options are not related to hot site that's why they are incorrect option.
8 0
3 years ago
Other questions:
  • Opportunity cost is the least desirable alternative given up as a result of a decision.
    6·1 answer
  • Which of the following characters at the beginning of a cell signifies to Excel that it should perform a calculation for the val
    13·1 answer
  • Write a function M-file that takes as input two matrices A and B, and as output produces
    8·1 answer
  • The part of the computer that provides access to the internet is the?
    14·1 answer
  • Consider a movie database in which data is recorded about the movie industry. the data requirements are summarized as follows:
    15·1 answer
  • Please help, Tech class!!
    14·1 answer
  • What is a Hard Drive
    13·1 answer
  • Using direct mapping, consider a 16-bit memory addresses, and a cache with 64 blocks, where each block is 8 bytes. What is the s
    8·1 answer
  • Which of the following is not related to text formatting?​
    11·1 answer
  • If you want to share information with individuals who are internal to your organization, which type of network would you want to
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!