fork download
  1. import java.util.Random;
  2. import java.util.Scanner;
  3.  
  4. class Main
  5. {
  6. public static String getWords(String cat, String diff)
  7. {
  8. String name = "";
  9. Random generator = new Random();
  10. String topic[][][] = new String[3][3][3];
  11. int location = generator.nextInt(3);
  12.  
  13. // initialize array
  14. topic[0][0][0] = "Paris";
  15. topic[0][0][1] = "London";// Easy-Places \\
  16. topic[0][0][2] = "Sydney";
  17.  
  18. topic[0][1][0] = "Toronto"; // medium places
  19. topic[0][1][1] = "Florida";
  20. topic[0][1][2] = "Frankfurt";
  21.  
  22. topic[0][2][0] = "Barcelona"; // hard places
  23. topic[0][2][1] = "Vancouver";
  24. topic[0][2][2] = "Zimbabwe";
  25.  
  26. topic[1][0][0] = "Halo"; //
  27. topic[1][0][1] = "Fifa"; // Easy-Games
  28. topic[1][0][2] = "Gta"; //
  29.  
  30. topic[1][1][0] = "Skyrim"; // med games
  31. topic[1][1][1] = "Hitman";
  32. topic[1][1][2] = "Batman";
  33.  
  34. topic[1][2][0] = "Minecraft"; // hard games
  35. topic[1][2][1] = "Zombieville";
  36. topic[1][2][2] = "BoderLands";
  37.  
  38. topic[2][0][0] = "Acura"; // easy cars
  39. topic[2][0][1] = "Audi";
  40. topic[2][0][2] = "Bmw";
  41.  
  42. topic[2][1][0] = "Bentley"; // med cars
  43. topic[2][1][1] = "Buggati";
  44. topic[2][1][2] = "Honda";
  45.  
  46. topic[2][2][0] = "Lamborghini"; // hard cars
  47. topic[2][2][1] = "Rolls-royce";
  48. topic[2][2][2] = "Mercedes";
  49.  
  50. if (cat.equalsIgnoreCase("places")) {
  51. if (diff.equalsIgnoreCase("easy"))
  52. name = topic[0][0][location];
  53. if (diff.equalsIgnoreCase("medium"))
  54. name = topic[0][1][location];
  55. if (diff.equalsIgnoreCase("hard"))
  56. name = topic[0][2][location];
  57. }
  58. else if (cat.equalsIgnoreCase("games")) {
  59. if (diff.equalsIgnoreCase("easy"))
  60. name = topic[1][0][location];
  61. if (diff.equalsIgnoreCase("medium"))
  62. name = topic[1][1][location];
  63. if (diff.equalsIgnoreCase("hard"))
  64. name = topic[1][2][location];
  65. }
  66. if (cat.equalsIgnoreCase("cars")) {
  67. if (diff.equalsIgnoreCase("easy"))
  68. name = topic[2][0][location];
  69. if (diff.equalsIgnoreCase("medium"))
  70. name = topic[2][1][location];
  71. if (diff.equalsIgnoreCase("hard"))
  72. name = topic[2][2][location];
  73.  
  74. }
  75. return name.toLowerCase();
  76. }
  77.  
  78. public static void main(String[] args)
  79. {
  80. Scanner kbd = new Scanner(System.in);
  81. System.out.println("Enter diff: ");
  82. String diff = kbd.nextLine();
  83. System.out.println("Enter cat: ");
  84. String cat = kbd.nextLine();
  85. System.out.println("Choosen word: " + getWords(cat, diff));
  86. }
  87.  
  88. }
  89.  
Success #stdin #stdout 0.05s 246144KB
stdin
easy
places
stdout
Enter diff: 
Enter cat: 
Choosen word: paris