Lab9C: 2D or not 2D For this exercise you will also be writing a program that will be building upon Lab9A. So please make a new class file, copy, and rename the code you have already written for Lab9A. Please also remember to rename the file and (and in the case of Java and C# students) class name to Lab9C. For this exercise, please take the array that was filled up with values and flatten it i.e., convert the 2-D array to a 1-D array that contains the same values. Please do not just print the 2-D array to look like a 1-D array

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 9PE
icon
Related questions
Question

c++

Lab9C: 2D or not 2D
For this exercise you will also be writing a program that will be building upon Lab9A. So please make a
new class file, copy, and rename the code you have already written for Lab9A. Please also remember
to rename the file and (and in the case of Java and C# students) class name to Lab9C.
For this exercise, please take the array that was filled up with values and flatten it i.e., convert the 2-D
array to a 1-D array that contains the same values. Please do not just print the 2-D array to look like
а 1-D array
Hint: You will have to take the 2-D array's total amount of cells and make a 1-D array of the same size.
Please refer to the sample output below for visualization and match its style.
As always:
Transcribed Image Text:Lab9C: 2D or not 2D For this exercise you will also be writing a program that will be building upon Lab9A. So please make a new class file, copy, and rename the code you have already written for Lab9A. Please also remember to rename the file and (and in the case of Java and C# students) class name to Lab9C. For this exercise, please take the array that was filled up with values and flatten it i.e., convert the 2-D array to a 1-D array that contains the same values. Please do not just print the 2-D array to look like а 1-D array Hint: You will have to take the 2-D array's total amount of cells and make a 1-D array of the same size. Please refer to the sample output below for visualization and match its style. As always:
Sample Output #1:
Please enter the number of rows: 4
Please enter the number of columns: 4
I have 4 rows and 4 columns. I need to fill-up 16 spaces.
The 4x4 array:
1|2|3|4||
5|6|7|8|
9|10|11|12|
13|14|15|16||
The 4x4 2-D array flattened into a 16 cell 1-D array:
1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16||
Sample Output #2:
Please enter the number of rows: 3
Please enter the number of columns: 2
I have 3 rows and 2 columns. I need to fill-up 6 spaces.
The 3x2 array:
1|2||
3|4|
5|6|
The 3x2 2-D array flattened into a 6 cell 1-D array:
1|2|3|4|5| 6||
Transcribed Image Text:Sample Output #1: Please enter the number of rows: 4 Please enter the number of columns: 4 I have 4 rows and 4 columns. I need to fill-up 16 spaces. The 4x4 array: 1|2|3|4|| 5|6|7|8| 9|10|11|12| 13|14|15|16|| The 4x4 2-D array flattened into a 16 cell 1-D array: 1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|| Sample Output #2: Please enter the number of rows: 3 Please enter the number of columns: 2 I have 3 rows and 2 columns. I need to fill-up 6 spaces. The 3x2 array: 1|2|| 3|4| 5|6| The 3x2 2-D array flattened into a 6 cell 1-D array: 1|2|3|4|5| 6||
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT