Search:

Type: Posts; User: Norm

Search: Search took 0.40 seconds.

  1. Replies
    31
    Views
    2,414

    Re: 2 dime array with following methods

    Two dim arrays require two indexes.
    The first index will be for the second row where the data to be searched is: [1]
    The second index will be the looping index:i or the min variable pointing to...
  2. Replies
    31
    Views
    2,414

    Re: 2 dime array with following methods

    Change the code in the test program to use a 2 dim array with data in the second row:

    int [][] smallestIndex = {{1}, {13,11,12,10,14,15 }} ;

    Then change the loop to search the data in the...
  3. Replies
    31
    Views
    2,414

    Re: 2 dime array with following methods

    Did that code work? It looks like it could.

    If it works, then consider what changing the array to two dimensions will do to the coding.
  4. Replies
    31
    Views
    2,414

    Re: 2 dime array with following methods

    I think the two dim array is confusing you. To learn how to use arrays and the indexes to arrays, try writing a simpler program. Write a new program that defines a short (3 element) array. Write a...
  5. Replies
    31
    Views
    2,414

    Re: 2 dime array with following methods

    With the following expression: theArray[theIndex]
    the value of the contents of the array is given by: theArray[theIndex]
    and the value of the index is in the variable: theIndex

    It depends on...
  6. Replies
    31
    Views
    2,414

    Re: 2 dime array with following methods

    The temp array has two dimensions. The righthand reference needs to use TWO indexes, like the lefthand array reference does.
  7. Replies
    31
    Views
    2,414

    Re: 2 dime array with following methods

    What will the methods in the separate class do?


    What is being compared in the if statements in the code in post#19?

    if (temp[i][1] < indexLowTemp)
    ...
    if (temp[i][1] > indexHighTemp)
    ...
  8. Replies
    31
    Views
    2,414

    Re: 2 dime array with following methods

    Depends on what the assignment says. I use a main() method in the class to be tested that calls all the methods in the class for testing instead of writing a separate class to put the main() method...
  9. Replies
    31
    Views
    2,414

    Re: 2 dime array with following methods

    A suggestion: write a test program that defines a two dimensional array and uses a nested loop to print out all the elements in the array. That will require you to use indexing to access all the...
  10. Replies
    31
    Views
    2,414

    Re: 2 dime array with following methods

    You need to format the code so it is easier to read:
    Please edit your post and wrap your code with


    <YOUR CODE HERE>

    to get highlighting and preserve formatting.


    Obviously the code is...
  11. Replies
    31
    Views
    2,414

    Re: 2 dime array with following methods

    what is your question?
    A two dim array has two indexes for any element.


    Please edit your post and wrap your code with


    <YOUR CODE HERE>

    to get highlighting and preserve formatting.
  12. Replies
    31
    Views
    2,414

    Re: 2 dime array with following methods

    You gave the answer here: row 0 coulmn 1
    those are the two indexes to the element: 3

    Please edit your post and wrap your code with


    <YOUR CODE HERE>

    to get highlighting and preserve...
  13. Replies
    31
    Views
    2,414

    Re: 2 dime array with following methods

    Can you explain. I don't understand your question.

    The compiler is giving an error because one of the operands in the comparison is an array, not an element of an array.
    You can not compare...
  14. Replies
    31
    Views
    2,414

    Re: 2 dime array with following methods

    temp[i] is an array, not an element of an array
    with a 2 dim array, you need two indexes
  15. Replies
    31
    Views
    2,414

    Re: 2 dime array with following methods

    To look at an element in a two dim array, you need to use two indexes: temp[0][1]
    If you want to look at data in only one column, set the second index to the value for that column:...
  16. Replies
    31
    Views
    2,414

    Re: 2 dime array with following methods

    What are you trying to compare? temp is a two dimensional array. The < operator does not work with arrays.
    It would work with elements of an array. For example: temp[1][2]

    Please edit your post...
Results 1 to 16 of 16