You will create a program with 3 methods. For the previoushomework with three problems, you will create a method for eachproblem.
In the main method, you will declare the three arrays and createthe memory space for each of them. The first method will receive aone dimension array and then it will assign the values ( e.g., a[4]= 4*4*4*4;). The second method receives a 2 dimensional array andcreates the calendar. The third method receives a two dimensionalarray and inverts row 1 in row.
Please note that you already have the bodies of the methods. Youare only creating the methods and calling them in the mainmethod.
You will also create methods printOneDimArray;printArrayCalendar; and printTwoDimArray to print each of thearrays.
Previous Homework Instructions
- Assigning values to an array. Write a pseudoand the java code that for the first 10 numbers, the calculatednumber is equal to that number multiplied by itself that number oftimes. The result is saved in an array in the number cell. Also,you shall print all the values of the array.
Constraints: you must use a loop instruction to assign values tothe array.
arrayNum [0] = 0
arrayNum [1] = 1
arrayNum [2] = 2*2
arrayNum [3] = 3*3*3
arrayNum [4] = 4*4*4*4
…
arrayNum [10] = 10*10*10…..*10
Hints: a) arrayNum [2] has a value of4 and arrayNum [3] has a value of 27; b) use one loop to traversethe array and another to calculate the value based on the currentindex.
- Assigning values to a multidimensional array.Write a pseudocode and java code that puts the days of the monthorganized by weeks (as a calendar). Use a matrix of 5 x 7 (weeks of7 days). Day 1 starts at [0][0]. See image in class ppt forarrays.
Hint: a) use one loop to manage theweeks and another to manage the days of the weeks
- Manipulating arrays. Given a two dimensionalarray, invert the first row into the second row. Â Â Printthe array once you have inverted the first row. Initialize yourarray as follows:
int [ ] [ ] myBiDimArrayNum = {
                                                        {1, 3, 5 ,7},
                                                        { 0, 0, 0, 0 }
                                                     };
Note: you algorithm should modify the array as follow:
myBiDimArrayNum  Â
  row 1: 1, 3, 5 ,7
  row 2: 7, 5, 3, 1
previous homework attached below
1) public class Test{
public static void main(String []args){
int[] arrayNum=new int[11];
for(int i=0;i<=10;i++)
{
arrayNum[i]=i;
for(int j=0;j{
arrayNum[i]=arrayNum[i]*i;
}
}
System.out.println(\"Array is\");
for(int i=0;i<=10;i++)
{
System.out.println(\"arrayNum[\"+i+\"]=\"+arrayNum[i]);
}
}
}
2) import java.util.Scanner;
import java.util.Arrays;
 Â
public class MyClass
{
public static void main(String args[])
{
int [ ] [ ] matrix = new int [5][7];
Scanner sc = new Scanner(System.in);
int days=1;
System.out.println(\"Assigning Values\");
for (int i = 0; i <5; i++)
{
for (int j = 0; j < 7; j++)
{
matrix[i][j] = days++;
if(days==32)
{
break;
}
}
//because day can be 31 only.
if(days==31)
{
break;
}
}
 Â
for (int i = 0; i < 5; i++)
{
// Loop through all elements of current row
for (int j = 0; j < 7; j++)
{
System.out.print(matrix[i][j] + \" \");
}
System.out.println();
}
 Â
}
}
3)
import java.util.Scanner;
import java.util.Arrays;
 Â
public class MyClass
{
public static void main(String args[])
{
int [ ] [ ] myBiDimArrayNum = {
{ 1, 3, 5 ,7},
{ 0, 0, 0, 0 }
};
Scanner sc = new Scanner(System.in);
int days=1;
System.out.println(\"Manipulating Array\");
for (int i = 0; i <2; i++)
{
//take this variable to copy elements from end of row first.
int last=3;
for (int j = 0; j < 4; j++)
{
//because indexing start from zero 1 will represent row second nowwe have to change its content.
if(i==1)
{
//As we have to manipulate the second from ending of row first weare using ***(i-1) and assign it to second row that is **(i).
myBiDimArrayNum[i][j]=myBiDimArrayNum[i-1][last];
last--;
}
}
}
 Â
for (int i = 0; i < 2; i++)
{
// Loop through all elements of current row
for (int j = 0; j < 4; j++)
{
System.out.print(myBiDimArrayNum[i][j] + \" \");
}
System.out.println();
}
 Â
}
}