trying to show an array
hey guys am working on a conversion program at the minute just messing really and i was wondering how i could get this damn thing working what i've got is a **** load of data in to multidimensional arrays 1 2 dimensional one and 1 3 dimensional one well heres what i've got any way.
what am trying to acomplish here is to setup a joption pain gui which when say a user enters a number it brings up a value within my miltidimensional array this may seem completely basic to u but bare in mind i am a noobie:D
import javax.swing.*;
public class arraytest
{
public static void main(String[] args)
{
new arraytest();
}
public arraytest()
{
/*aray of names and categories defined*/
String names [][] = new String [3][2];
names[0][0]="Fred Grindle";
names[0][1]="Test Male";
names[1][0]="Emma Warber";
names[1][1]="Test Female";
names[2][0]="James Fletch";
names[2][1]="Control Female";
String number = JOptionPane.showInputDialog("Please enter a number which resembles the weight value you wish to be converted\n Name\t\t Weight 1\t\t Weight 2\t\tweight 3");
int num = Integer.parseInt(number);
String names = "";
switch(num)
{
case 1:
names="Fred Grindle";
break;
case 2:
names="Emma Warber";
break;
case 3:
names="James Fletch";
break;
}
JOptionPane.showMessageDialog(null,"the name you chose was"+names);
JOptionPane.showMessageDialog(null,"Thankyou Goodbye");
System.exit(0);
}
}
in opposite world i love programming
__________________
in opposite world i love programming
|