Write a Java application and use a Two dimensional array to store five Dutch, French and Italian translated words. Use a single array to store the English words. Your program must:
Q.2.1 Contain a single array to contain the following five English words and a Two dimensional array to store the following Dutch, French and Italian translated words. ENGLISH WORD sky, run, study, music
DUTCH WORD hemel, rennen, studie, muziek
FRENCH WORD ciel, courir, etude, musique
ITALIAN WORD cielo, correre, studia, musica
Q.2.2 Print out each English word with the translated Dutch, French and Italian word.
public class App {
/**
* The start point of the program
*
* @param args
*/
public static void main(String[] args) {
String englishWords[] = { "sky", "run", "study", "music" };
String dutchFrenchItalianTranslatedWords[][] = { { "hemel", "rennen", "studie", "muziek" },
{ "ciel", "courir", "etude", "musique" }, { "cielo", "correre", "studia", "musica" } };
System.out.printf("%-10s%-10s%-10s%-10s\n", "English", "Dutch", "French", "Italian");
for (int i = 0; i < englishWords.length; i++) {
System.out.printf("%-10s%-10s%-10s%-10s\n", englishWords[i], dutchFrenchItalianTranslatedWords[0][i],
dutchFrenchItalianTranslatedWords[1][i], dutchFrenchItalianTranslatedWords[2][i]);
}
}
}
Comments
Leave a comment