Question: programming lamguage is java Task 5:Set and Map Define a Set and Map as following: Set setStrings - new HashSet(); Set setIntegers new HashSet(); Map
Task 5:Set and Map Define a Set and Map as following: Set setStrings - new HashSet(); Set setIntegers new HashSet(); Map map - new HashMap(); 1 - Ask the user to input an integer N, then ask the user to input N integers in both digits and in words as following: If the users entered N as 3: Please enter 3 different integers in both digits and words: Digits: 1 Word: One Digits: 4 Word: Four Digits: 5 Word: Five 2-add each entered digits into setIntegers.its string into setStrings, and match the digit and its word in the map, 3-print both sets, and mapiteratively. 4-using a loop, ask the user to enter random digits. check if the integer exists in setIntegers, if yes. print its mapped string from the map. 5 - now. ask the user to enter a word, check for its existance in serStrings, if yes, print the mapped digit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
