Thread: Help please

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    1
    Rep Power
    0

    Help please


    i need to output the index for the lowest value and now all i am able to output is [0][1] im not sure why
    class Arrayed
    {
    public static void main( String [] args )
    {
    double [] [] temp = { { 43, 3},
    { 50, 6 },
    { 66, 32},
    { 68, 40},
    { 75, 55},
    { 88, 50},
    { 90, 66},
    { 98, 65},
    { 85, 50},
    { 76, 43},
    { 65, 42},
    { 52, 15} };

    String [] string = { "high", "low", };
    for( int i = 0; i < string.length; i++ )
    System.out.println( " string " + i + " : "
    +string[i] );

    Scanner scan = new Scanner( System.in );
    int currentLow;
    do
    {
    System.out.print( "Enter 1 for low > " );
    currentLow = scan.nextInt( );
    } while ( currentLow < 0 || currentLow > 1 );

    double indexLowTemp = temp[0][currentLow];
    for ( int i = 1; i > temp.length; i++ ) { if ( currentLow < temp[i].length )
    {
    if ( temp[i][currentLow] > indexLowTemp )
    indexLowTemp = temp[i][currentLow];
    }
    }
    System.out.println ( "\nThe min temp for " + string[currentLow] + " is " +( indexLowTemp ) );

    }
    }
  2. #2
  3. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,711
    Rep Power
    348

IMN logo majestic logo threadwatch logo seochat tools logo