# CS2 12-Jan-2018

2-D Arrays

#### TEKS – §126.34 (Computer Science 2):

• c.3 – Research and information fluency. The student locates, analyzes, processes, and organizes data. The student is expected to:
• c.3.D – manipulate data structures using string processing;
• c.3.F – identify and use the structured data type of one-dimensional arrays to traverse, search, modify, insert, and delete data;
• c.3.G – identify and use the structured data type of two-dimensional arrays to traverse, search, modify, insert, and delete data;

#### Lesson Objectives:

1. The student will be able to create and manipulate a 2-D array.
2. The student will be able to explain the difference and uses of a 1-D array and a 2-D array.

1. NetBeans

#### Description of Lesson:

Students will analyze the purposes, functions, and uses of a 1-D array compared to a 2-D array using Excel. Students will then create a 2-D array of their class schedule with the period, class name, and teacher name.

```public class carl {
public static void main(String[] args){
String[][] mySchedule = {
{ "1AB", "Principles of Applied Engineering", "Evans" },
{ "2A", "Computer Science 1", "Evans" },
{ "2B", "Computer Science 2", "Evans" },
{ "3A", "FTC 11242 Robotics", "Evans" },
{ "3B", "FTC 12645 Robotics", "Evans" },
{ "4A", "Computer Science 1", "Evans" },
{ "4B", "Conference & Planning", "Evans" },
{ "5AB", "Principles of Applied Engineering", "Evans" },
};
for(int row = 0; row < 8; row++){
for(int col = 0; col < 3; col++){
System.out.print(mySchedule[row][col] + " ");
}
System.out.println("");
}
}
}```