Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Real Time Database Systems Architecture And Techniques

Authors: Kam-Yiu Lam ,Tei-Wei Kuo

1st Edition

1475784023, 978-1475784022

More Books

Students also viewed these Databases questions

Question

What are the purposes of promotion ?

Answered: 1 week ago