Question: Declare variable testPerformance as a HashMap with String key type and Double value type, representing the name and test score of a student. Read integer
Declare variable testPerformance as a HashMap with String key type and Double value type, representing the name and test score of a student. Read integer dataCount from input. Then read dataCount keyvalue pairs from input and insert each into testPerformance. If the key already exists, do not replace the key's existing value with the new value.
Ex: If the input is:
Ron Kim Kim
then one possible output is:
Key: Ron, Value: Key: Kim, Value:
import java.util.Scanner;
import java.util.HashMap;
public class ExamPerformance
public static void mainString args
Scanner scnr new ScannerSystemin;
String studentName;
double examScore;
int dataCount;
int i;
Any variable declarations go here
Your code goes here
For each key in the HashMap, retrieve the value associated with the key
for String key : testPerformance.keySet
System.out.printlnKey: key Value: testPerformance.getkey;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
