|
||
|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
I am trying on how to print values from an array all to show up on a dialog using a for loop. Can anybody help me with this?
Java Code
double[] dailyTemperatures;
dailyTemperatures= new double[7];
for (int d = 0; d<dailyTemperatures.length; d++)
{
String t;
t = JOptionPane.showInputDialog(null, "Enter daily temperature values:");
dailyTemperatures[d] = Double.parseDouble(t);
}// end for loop
for (int i =0; i <= 6; i++)
|
|
|||
|
Ok meaby that can help something...
Java Code
import javax.swing.*;
public class StringLengthTableModel{
public static void main(String[] args){
double[] dailyTemperatures = new double[7];
String a="";
for (int d = 0; d<dailyTemperatures.length; d++)
{
int[] t = new int[dailyTemperatures.length];
t[d]=new Integer(JOptionPane.showInputDialog("Enter daily temperature values:")).intValue();
String m="The temperature "+ d+ " - ";
a=a+t[d]+" Measure \n "+m;
}
JOptionPane.showMessageDialog(null,a);
}
}
Last edited by helloworld922; 22-03-2010 at 10:46 PM. Reason: [code] tags please |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Assgining values to array indexes | chronoz13 | Collections and Generics | 4 | 19-01-2010 07:01 PM |
| How do i show all the values in one window(JOptionPane)?? | Antonioj1015 | AWT / Java Swing | 1 | 26-11-2009 01:24 AM |
| Substitution of Values in Array | nyeung | Collections and Generics | 2 | 27-10-2009 12:02 AM |
| Having trouble insert/sorting array values w/ binary searching. | bh-chobo | Collections and Generics | 4 | 08-10-2009 07:38 AM |
| How to Populate all array values using the java.util.Arrays class | JavaPF | Java Code Snippets and Tutorials | 0 | 07-04-2009 10:31 AM |