
2DArray method:It will allocate a block of memory which represents a two-dimension array
based on the input values supplied by the user. Ask the user to enter the number of rows and
column for 2D array that the user want to manipulate. The number of rows and columns that the
user enters may or may not define a square matrix (when the number of rows equals the number
of columns). The array will have exactly rows time columns (m * n) elements. It will not
contain any extra or empty cells. Initialize the “matrix” by rows with random number between 1
to 100. Pass two arguments by out reference so that you can assign the number of row and
columns of data to the first and second arguments. This is return 2D array method after
allocating new memory for 2D array and initialize it with random value. Generate random
number code in C# as following: Random randnum = new Random( );
int number = randnum.Next (1, 101);
SwapRow method: it will rotate the data in the matrix in an up/down method such that the first
row is exchanged with last row (swap row 0 and row m-1, swap row 1 and row m-2, etc.).
SwapColumn method: it will rotate the data in the matrix in a left/right method such that the
first column is exchanged with the last column (swap column 0 and column n-1, swap column1
and column n-2, etc.)
RotateLeftDiagonal method: it will rotate the data in the matrix by the left diagonal. This
operation is usually referred to as a matrix transpose. This is done by exchanging element [i, j]
with element [j, i]. The values on the left diagonal do not move for a square matrix. Do not
forget to swap the values for the number of rows and columns. Pass these two arguments by
reference so that you can change their values.
RotateRightDiagonal method: it will rotate the data in the matrix by the right diagonal. This
operation will require that you exchange element [0, 0] with element [m-1, n-1]. The values on
the right diagonal do not move for a square matrix. Do not forget to swap the values of the
number of rows and columns. Pass these two arguments by reference so that you can change
their values.
DisplayArray method: it will print the array in a two-dimension format with rows and columns
as you would normally print a compile time defined two-dimension array. Be sure that the
columns are aligned correctly for display purposes.
Use type integer (int) for the array. In the main, program call methods in following order:
2DArray, SwapRow, SwapColumn, RotateLeftDiagonal, RotateRightDiagonal. After each
method has been called you must print the matrix, which is calling DisplayArray method, and
pause the program so that the result of the operation can be viewed. After the results of the
operation of 4 methods has been printed, then continue running the program until the user want
to quit. Clearly label each matrix with the operation that was performed on the matrix.

Trending nowThis is a popular solution!
Step by stepSolved in 2 steps

- Create a DWORD array named 'z’ of size 3 using DUP operator. Leave the array 'z' uninitialized. You can denote the items in the array as [Zo, z1, z2], where z, is the first item, z, is the second item, z, is the third item Update each array item using the following expressions. Ζox+ 130 Z13 у — х + Zo Z2 = r + x – Z1 Where x, y, r are 16-bit integer memory variables. x = 10, y= 15, r=4 Use mov, movzx, movsx, add, sub instructions only. (hint: Do not alter the value of x, y and r during the computation. Transfer them to appropriate registers to do computation) At the end, open memory window to see the variable z stored in memory (little endian format). Use the debugger to verify your answer. Submit the following: Rename the asm file using your last name as Lastnamel.asm Screenshot of the code and memory window showing the content of the variable z (little endian format).arrow_forwardConstruct a row array countValues from 0 to 25, elements incremented by incrementValue. Ex: If incrementValue is 5, countValues should be [0, 5, 10, 15, 20, 25].arrow_forwardThe Fibonacci numbers are 0, 1, 1, 2, 3, 5, 8, 13, ... where each number (after the first two values) is the sum of the previous two numbers. Write a program that declares an integer array called fib_numbers with a length of 25 elements. The program then fills the array with the first 25 Fibonacci numbers using a loop. The program then prints the values to the screen using a separate loop.arrow_forward
- int [] arrayInt={3,54,90,22,32}; To print the last element in the arrayInt you will write: a. System.out.println(arrayInt[5]); b. System.out.println(arrayInt[0]); c. System.out.println(arrayInt[length]); d. System.out.println(arrayInt[4]);arrow_forwardAn int array stores the following values: 9 4 12 2 6 8 18 How many passes will it take for a selection sort to sort this array?arrow_forwardPlease use java as the programing language and write comments! Thanks!arrow_forward
- In this project you will generate a poker hand containing five cards randomly selected from a deck of cards. The names of the cards are stored in a text string will be converted into an array. The array will be randomly sorted to "shuffle" the deck. Each time the user clicks a Deal button, the last five cards of the array will be removed, reducing the size of the deck size. When the size of the deck drops to zero, a new randomly sorted deck will be generated. A preview of the completed project with a randomly generated hand is shown in Figure 7-50.arrow_forwardcan you please write this in java.util.scanner form and can you make it so i can copy and past it, thank you.can you please write this in java.util.scanner form and can you make it so i can copy and past it, thank you. 2D Array OperationsWrite a program that creates a two-dimensional array initialized with test data. Use anyprimitive data type that you wish. The program should have the following methods:• getTotal. This method should accept a two-dimensional array as its argument andreturn the total of all the values in the array.• getAverage. This method should accept a two-dimensional array as its argument andreturn the average of all the values in the array.• getRowTotal. This method should accept a two-dimensional array as its first argumentand an integer as its second argument. The second argument should be the subscriptof a row in the array. The method should return the total of the values in thespecified row.• getColumnTotal. This method should accept a two-dimensional array…arrow_forwardPrint true if the user-entered array contains, somewhere, three increasing adjacent. Programming language: Javaarrow_forward
- se for loops on the above 2D array to: •Find how many ZEROsand how many negative numbersare in the matrixand display results*HELP: declare a variable “count_zero= 0and count_neg=0” and increment the count each time you findzero and negativearrow_forwardInteger numElements is read from input and represents: • The number of elements in each array. • The number of pairs of integers read from input. Declare two integer arrays, roomIds and serviceFees. Then, read each pair of integers from input. For each pair read, store the first integer into roomlds and the second integer into serviceFees. Ex: If the input is: 3 2 50 4 25 8 40 then the output is: Room id: 2, Fees: $50 Room id: 4, Fees: $25 Room id: 8, Fees: $40 1 import java.util.Scanner; 2 3 public class Cash Records { 4 5 6 8 9 10 11 12 13 14 15 16 17} public static void main(String[] args) { Scanner scnr= new Scanner (System.in); int numElements; int i; numElements = scnr.nextInt (); /* Your code goes here */ for (i = 0; i < numElements; ++i) { System.out.println("Room id: " + roomIds[i] + ", Fees: $" + serviceFees[i]); }arrow_forwardWhat values will be written to the array when the following code executes? data array DWORD 4 DUP(0) code main PROC mov eax, 5 mov esi, 0 call proc_1 add esi,4 add eax 3 k mov array[esi] eax INVOKE ExitProcess 0 main ENDF proc 1 PROC call proc_2 add esi, 4 add eax, 3 mov array[esi], eax ret proc 1 ENDP proc 2 PROC call proc_3 add esi.4 add eax 3 mov array[esi] eax ret Proc RENDE proc_3 PROC mov array[esi] eax ProcA ENDP Answer: arrayarrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY





