Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Write a program that creates and returns a one-dimensional array containing all the elements in a 10 X 12 twodimensional array. Store the values in a...

Write a program that creates and returns a one-dimensional array containing all the elements in a 10 X 12 twodimensional array. Store the values in a row major format. You will populate the random number in two-dimensional array with a range between 1 and 100 (inclusive). Display both the two-dimensional and the one-dimensional array. Format your numbers to allow 4 spaces to display each number with default alignment. 

In this program, you will create 4 static methods which are as follows. 

static void FillTwoDimArray( int[ , ] twoDArray)       //method to fill twoD array with random numbers 

static void DisplayTwoDimArray( int[ , ] twoDArray)   //display twoD arrays 

       static void StoreValues(int[ , ] twoDArray, int [ ] oneDArray) //copy twoD array values into oneD array 

       static void DisplayOneDimArray(int[ ] oneDArray)    //diaply oneD array 

Create a new project and name it FirstName_LastName_A1 where FirstName is your first name and LastName is your last name. Zip your project folder and submit it in Eagle online for grading.  

Some Hints: 

1. To generate random number in C#: Random myRandom = new Random();  //Random class is under System namespace myNumber = myRandom.Next(1, 101); //generate number between 1-100 inclusive 2. use nested for loop to traverse twoD array: for (int row = 0; row < twoDArray.GetLength(0); row++) //each row   {   for (int col = 0; col < twoDArray.GetLength(1); col++ ) //each column   {           //code     } } 3. When coping twoD array to oneD array, there are different ways to refer to the index of oneD array. The simplest way is to create an index variable and keep incrementing it until you finish traversing the twoD array.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question