0

Is the bowling game lesson/test 71 a multipart answer that all goes in one class? Or separate test questions of their own.

import java.util.HashMap;import java.util.Map;import java.util.Scanner; public class Bowling { public static <K, V extends Comparable<V>> Map.Entry<K, V> getMaxEntryInMapBasedOnValue(Map<K, V> map) { Map.Entry<K, V> entryWithMaxValue = null; for (Map.Entry<K, V> currentEntry : map.entrySet()) { if (entryWithMaxValue == null || currentEntry.getValue().compareTo(entryWithMaxValue.getValue()) > 0) { entryWithMaxValue = currentEntry; } } // end loop // display the KEY ONLY which has maximum VALUE System.out.print(entryWithMaxValue.getKey()); return entryWithMaxValue; }// end method public static void print(Map<String, Integer> map) { System.out.print("Map: "); if (map.isEmpty()) { System.out.println("[]"); } else { System.out.println(map); } } public static void main(String[] args) { Map<String, Integer> map = new HashMap<>(); map.put("John", 100); map.put("James", 55); map.put("Julie", 98); getMaxEntryInMapBasedOnValue(map); System.out.print("\n\n"); }// end main}// end class

15th Jul 2021, 3:51 AM
Charles
Charles - avatar
2 Answers
+ 2
This is the last exam needed for the certificate.
15th Jul 2021, 4:45 AM
JaScript
JaScript - avatar
0
Yes it is. There are 4 Tests under part 71. The code outputs the correct answer for Test 1. Then sololearn goes to Test 2. After I enter the new values, it outputs the correct answer for Test 2, but sololearn goes back to Test 1 as if I were answering it, and then marks it wrong. Any clue what I am missing. Is it multipart question with one answer which covers/includes all 4 Tests, or does each Test have a separate/independent answer. I can't tell if I'm doing something wrong or if sololearn is messed up. I'm so close to finishing and have a deadline 07/16/21. I have looked all over the net and asked in several places working this for several days. I can post a seconds long screen record if it would help.
15th Jul 2021, 6:34 AM
Charles
Charles - avatar