How can I do this more efficiently ?
Hi I'm hoping you can advise me on a piece of code I'm trying to write. This problem could be done very easily using an access database but I decided I wanted to do it in a standalone Java app, just for practice more than anything.
I want the user to input a 3 later code which will return the corresponding City name and Country. I want to do this for about 100 Cities.
e.g. user enter DUB program returns - "This Code is Dublin and the Country is Ireland"
So far i've been able to do this using if else statements for a few datavalues but obviously I don't want to write if else statements for 100 values. Anyone have any advise or is it just stupid trying to do this with Java
What I currently have
code = JOptionPane.showInputDialog(null, "Enter the 3 Digit Site Code?");
JOptionPane.showMessageDialog(null, "This Site Code is Dublin, Counry is Ireland");}
JOptionPane.showMessageDialog(null, "This Site Code is Ney York Country is America");}
JOptionPane.showMessageDialog(null, "Site Code Not Found");}