Answer:
- import java.util.Arrays;
- public class Main {
-
- public static void main(String[] args) {
- String [] first = {"David", "Mike", "Katie", "Lucy"};
- String [] middle = {"A", "B", "C", "D"};
- String [] names = makeNames(first, middle);
-
- System.out.println(Arrays.toString(names));
- }
-
- public static String [] makeNames(String [] array1, String [] array2){
-
- if(array1.length == 0){
- return array1;
- }
-
- if(array2.length == 0){
- return array2;
- }
-
- String [] newNames = new String[array1.length];
-
- for(int i=0; i < array1.length; i++){
- newNames[i] = array1[i] + " " + array2[i];
- }
-
- return newNames;
- }
- }
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]
Answer:
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim sum, product, num1, num2 As Integer
num1 = Val(TextBox1.Text)
num2 = Val(TextBox2.Text)
sum = num1 + num2
product = num1 * num2
TextBox3.Text = sum
TextBox4.Text = product
End Sub
End Class
- Explanation:
- The solution is implemented in Visual Basic Programming Language
- Two textboxes are created to receive the user's input and two textboxes for displaying sum and product respectively
- Each of these controls are appropriately labeled (See the attached GUI interface)
- The Sum is calculated by adding the values from textbox1 and 2
- The product is calculated by multiplying both
Answer:
This rep can be removed from the chart without deleting the data. a) Filter the Sales Rep Field in the PivotChart and deselect the employee's checkbox.
Answer:
The function in C is as follows:
#include <stdio.h>
int C_ball(int height){
if(height == 1) {
return 1;}
return (height * height) + C_ball(height - 1);}
int main(){
int n;
printf("Height: ");
scanf("%d",&n);
printf("Balls: %d",C_ball(n));
return 0;
}
Explanation:
The function begins here
#include <stdio.h>
This defines the function
int C_ball(int height){
If height is 1, return 1
<em>if(height == 1) {
</em>
<em> return 1;}</em>
This calls the function recursively
return (height * height) + C_ball(height - 1);}
The main begins here
int main(){
This declares the height as integer
int n;
This prompts the user for the height
<em> printf("Height: ");
</em>
<em> scanf("%d",&n);</em>
This calls the function
printf("Balls: %d",C_ball(n));
return 0;
}
Answer:
Following are the solution to the given response:
Explanation:
The ethical dilemma lies in the conflict between two moral principles. Such kinds of fictitious or imagined dilemmas often are designed to assess individuals' moral principles and moral reasoning.
If your ethical standards, beliefs, and values run against any at work. You could choose to be honest and dishonest and to choose between what you know is right and also what you know was wrong.
issue:
Ethical issues arise when a specific decision, situation, or activity clashes with the moral expectations of morality.
Sometimes these conflicts are lawfully hazardous, as some alternatives to solving the problem may violate a particular law.
Link: https://www.comptia.org/blog/ethical-problems-in-computing