Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439

This lab is concerned with manipulating arrays of two dimensions. This set of exercises is ensure you can use loops to navigate and manipulate a 2D array in many different ways. You don't have to complete every example, but make sure you understand how to do so since 2D arrays and some of the methods from this lab sheet will be used in the next assessed lab and in the project.

2D Array Exercises

In each case you need to write a method that performs some calculations on a parameter array. Put all these methods into a utility class called Array2DExercises.

Download the JUnit tester to test your code. If you think of test cases that cover new situations, then you can add them to the tester.

The lab exercises are all based on the simplest case, where the base type of the array is primitive. But you should always consider how to extend this to the situation where the base type is a reference type. For example, for an array of BankAccounts or WeatherStations.

If you think of a 2d-array a as a matrix, then the sub-arrays a[0], a[1], etc are the rows of the matrix. Thus row 0 consists of the elements a[0][0], a[0][1], a[0][2], etc. Then column 0 is the elements a[1][0], a[2][0], a[3][0] and so on.