0
how to code this . sum of hashmap map.put("A",3); map.put("B",2); map.put("C",3); map.put("D",2); Enter : A Enter: B total : 5
2 odpowiedzi
+ 1
HashMap<String, Integer> map = new HashMap<>();
map.put("A",3);
map.put("B",2);
map.put("C",3);
map.put("D",2);
String input1 = "A"; //I simplified example with hardcoded strings,
String input2 = "B"; //you can replace it with user input if you need.
System.out.println("Total: " + (map.get(input1)+map.get(input2)));
+ 1
thank u so much