Answer:
In Java:
public static int[] inputArray(){
Scanner input = new Scanner(System.in);
int[] alpha = new int[20];
for(int i = 0;i<20;i++){
alpha[i] = input.nextInt();
}
return alpha;}
public static int[] doubleArray(int [] alpha){
int[] beta = new int[20];
for(int i = 0;i<20;i++){
beta[i] = 2 * alpha[i];
}
return beta;
}
public static int[] copyAlphaBeta(int [] alpha, int [] beta){
int [] AlphaBeta = new int[10];
for(int i = 0;i<5;i++){
AlphaBeta[i] = alpha[i];
}
int count = 5;
for(int i = 15;i<20;i++){
AlphaBeta[count] = beta[i];
count++;
}
return AlphaBeta;
}
public static void printArray(int [] alpha){
for(int i = 0;i<20;i++){
System.out.print(alpha[i]+" ");
if((i+1)%15 == 0){
System.out.println(" ");
}
}
}
Explanation:
The inputArray is defined here
public static int[] inputArray(){
Scanner input = new Scanner(System.in);
This declares alpha array of 20 elements
int[] alpha = new int[20];
The following iteration gets input from the user into the array
<em> for(int i = 0;i<20;i++){</em>
<em> alpha[i] = input.nextInt();</em>
<em> }</em>
This returns the alpha array
return alpha;}
The doubleArray is defined here. It takes the alpha array as its input parameter
public static int[] doubleArray(int [] alpha){
This declares beta of 20 integers
int[] beta = new int[20];
This populates beta by 2 * alpha[i]
<em> for(int i = 0;i<20;i++){</em>
<em> beta[i] = 2 * alpha[i];</em>
<em> }</em>
This returns the alpha array
return beta;}
The copyAlphaBeta array is defines here
public static int[] copyAlphaBeta(int [] alpha, int [] beta){
This declares AlphaBeta as 10 elements
int [] AlphaBeta = new int[10];
This populates the first 5 elements of AlphaBeta with the first 5 of alpha
<em> for(int i = 0;i<5;i++){</em>
<em> AlphaBeta[i] = alpha[i];</em>
<em> }</em>
int count = 5;
This populates the last 5 elements of AlphaBeta with the last 5 of beta
<em> for(int i = 15;i<20;i++){</em>
<em> AlphaBeta[count] = beta[i];</em>
<em> count++;</em>
<em> }</em>
This returns the AlphaBeta array
return AlphaBeta;
}
The printArray is defined here. It takes the alpha array as its input parameter
public static void printArray(int [] alpha){
This iterates through alpha array
for(int i = 0;i<20;i++){
This prints each element of the array
System.out.print(alpha[i]+" ");
A new line is started after the 15th element
<em> if((i+1)%15 == 0){</em>
<em> System.out.println(" ");</em>
<em> }</em>
}
}
See attachment for complete program which includes the main