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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started