I am trying on how to print values from an array all to show up on a dialog using a f
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?
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++)
i want to print all my values in just one dialog box. I would rather use a for loop but if you guys can not tell me another way it is okay
Re: I am trying on how to print values from an array all to show up on a dialog using
Ok meaby that can help something...
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);
}
}