Sergei_Langin

Sergei FlashCards Stage 6 part "hardest card"

Apr 12th, 2020
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.29 KB | None | 0 0
  1. case "hardest card":
  2.                     Collection<Integer> values2 = hashMap2.values();
  3.                     int count = 0;
  4.                     for (Integer Value2 : values2) {
  5.                         if (Value2 > 0) {
  6.                             count++;
  7.                             list2.add(Value2);
  8.                         }
  9.                     }
  10.                     if (count == 1) {
  11.                         System.out.println("The hardest card is \"" +
  12.                                 getKeyFromValue2(hashMap2, (Integer) list2.get(0)).get(0) + "\"" +
  13.                                 ". You have " + list2.get(0) + " errors answering it.");
  14.                         list2.clear();
  15.                     } else if (count > 1) {
  16.                         System.out.println("The hardest cards are \"" +
  17.                                 getKeyFromValue2(hashMap2, (Integer) list2.get(0)).get(0) + "\"" +
  18.                                 ", \"" + getKeyFromValue2(hashMap2, (Integer) list2.get(1)).get(1) + "\"" + "." +
  19.                                 "You have " + list2.get(0) + " errors answering them.");
  20.                         list2.clear();
  21.                     } else {
  22.                         System.out.println("There are no cards with errors.");
  23.                     }
  24.                     break;
Advertisement
Add Comment
Please, Sign In to add comment