Results 1 to 1 of 1
  1. #1
    soccer_kid_6 is offline Member
    Join Date
    Feb 2010
    Rep Power

    Default arrays using doubles [SOLVED]

    This is my assignment:

    Declare and create an array of doubles called dailyTemperatures which holds a place for seven temperatures of type double.
    * Fill the elements of the array with values entered by the user

    This is my code:
    Java Code:
    		  double[] dailyTemperatures;
    		  dailyTemperatures= new double[7];
    		  for (double d = 0.00; d<dailyTemperatures.length; d++)
    		  			String t;
    		  			t = JOptionPane.showInputDialog(null, "Enter daily temperature values:");
    		  			dailyTemperatures[d] = Double.parseDouble(t);
    		        }// end for loop
    This is the error message i get "possible loss of precision
    found : double
    required: int
    dailyTemperatures[d] = Double.parseDouble(t);

    Nevermind. I have found my problem
    Last edited by soccer_kid_6; 03-10-2010 at 03:01 AM.

Similar Threads

  1. Arrays
    By tejens23 in forum New To Java
    Replies: 5
    Last Post: 11-25-2009, 11:46 PM
  2. GUI's and inputting doubles or ints
    By lopder1 in forum New To Java
    Replies: 19
    Last Post: 11-05-2009, 09:50 PM
  3. Problem with division using doubles
    By chrismanahan in forum New To Java
    Replies: 3
    Last Post: 10-10-2009, 09:26 PM
  4. Help!! With arrays
    By ookie833 in forum New To Java
    Replies: 8
    Last Post: 12-14-2008, 01:57 AM
  5. arrays strings and doubles
    By rgvbabe in forum New To Java
    Replies: 1
    Last Post: 01-14-2008, 12:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts