Write a program that creates and returns a one-dimensional array containing all
ID: 3537444 • Letter: W
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 row major format. You will populate the random number in two-dimensional
array with a range between 1 and 100. Display both the two-dimensional and the one-dimensional array.
In this program, you will create 4 static methods which are as follows.
static void FillTwoDimArray( int[ , ] twoDArray)
static void DisplayTwoDimArray( int[ , ] twoDArray)
static void StoreValues(int[ , ] twoDArray, int [ ] oneDArray)
static void DisplayOneDimArray(int[ ] oneDArray
Explanation / Answer
using System; public class ArrayConvert { public static void Main() { int[,] twoDArray = new int[10,12]; int[] int[10*12]; FillTwoDimArray(twoDArray); DisplayTwoDimArray(twoDArray); StoreValues(twoDArray,oneDArray); DisplayOneDimArray(oneDArray); } static void FillTwoDimArray( int[ , ] twoDArray) { Random rnd = new Random(); for(int i=0;iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.