00:01
Okay, so for this problem, they'd like us to create a class called location, which represents the maximum location of a 2d array.
00:12
They'd also like us to write a function that finds that location, and then write a little test to test our class and location.
00:22
So for our location class, the first thing we're going to want to do is add the fields.
00:28
We have a row field, a column field, which represent the location part, and then we also have a max value field, which is the value in the actual array.
00:50
So if these to work, we're going to have to create a little constructor and add a row, column, and max value parameter.
01:10
And then we will assign those to the correct fields.
01:30
Let's see, and then just for convenience, let's also create a string function that just returns those three values in a nice little string.
01:44
We can use the string .format function to insert it into a nice little text here.
01:53
Whoops, that'll print out the max value, the row, and the column.
02:05
Now to actually find the max value, we're going to have to iterate over this 2d array, which we passed in a here.
02:14
And then it would like us to return an instance of location.
02:19
So let's go ahead and initialize that to the first entry in the array.
02:29
The 0 -0 entry.
02:32
And the value will be a of 0.
02:38
And now we're going to want to iterate over all the rows in the array and since we want to save the actual row and column numbers we're going to use the range tool to iterate over the numbers rather than the actual rows and then we're also going to want to do the same thing for the columns and so for each of these values we're going to want to check if the value at row column is greater than the max value, max value and it is we're going to want to make that the new max value.
03:51
And at the end, we're just going to return whatever the max value was after we've iterated over all the elements.
04:04
For our test, let's come over here and create a new test method.
04:12
First thing we need to do is gather the input.
04:17
So the first thing is going to be the dimension.
04:23
So enter the number of rows and columns in the list.
04:34
And then we want to want to split that on a comma.
04:40
So we get both elements, row and the column.
04:44
And then we need to convert that integers...