Question: Write a program that reads in keyboard input. Your program should accept at least ten lines of data; once the ten lines have been consumed

Write a program that reads in keyboard input. Your program should accept at least ten lines of data; once the ten lines have been consumed by your program, then you can close the scanner. Hint: You must track the number of lines added by the user.

Each line should contain two values, one number and a string separated by commas. The string can contain words or sentences. The format should be displayed to the user during the initial prompt. Example: 15, roses are red

You must store the comma-delimited values into a Map. The key will represent a number and the value will represent the string. The words of the string must be stored as a list.

If an integer is listed more than once as keyboard input, then you must add the corresponding string values to the existing key/value pair in the map. After all input is added, remove any input that contains a key greater than 30.

Print the map. Close the scanner and thank the user for using your program.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!