i'm kinda new to Java so and currently studying it at school, but yeah on one of our assignments they asked us to create a program that reads a letter given by a user and then gives the corresponding morse code. They also specified that we have to use 2 arrays, one with the 26 letters of the alphabet and one with their corresponding morse codes for that assignment. Where i'm stuck is I dunno how to make the program look through 2 arrays and make it understand that the first index of the first array equals the first index of the second array, and etc.
Heere's my code so far (and yes its in french because i'm in a french speaking province and school so if you need clarification on my code, just lemme know):
import javax.swing.JOptionPane;
/**
*
* @author alex_
*/
public class Morse {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
char lettre = ' ';
char tLettre[] = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N',
'O','P','Q','R','S','T','U','V','W','X','Y','Z'};
String tMorse[] = {".-","-...","-.-.","-..",".","..-.","--.","....","..",
".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-",
"..-","...-",".--","-..-","-.--","--.."};
lettre = JOptionPane.showInputDialog("Entrez la lettre que vous voulez traduire: ").charAt(0);
}
}
So yeah sorry for my english if it's not that good