Question: In Java: Write a program that creates: - An array of Strings of length 5 (I named mine keys ) - An array of ints

In Java:

In Java: Write a program that creates: - An array of Strings

of length 5 (I named mine keys ) - An array of

ints of length 5 (I named mine Do not use the ArrayList

class. Your program should then do the following: - Get a string

Write a program that creates: - An array of Strings of length 5 (I named mine keys ) - An array of ints of length 5 (I named mine Do not use the ArrayList class. Your program should then do the following: - Get a string "key" from the user and an int value. It should store those in index 0 in the respective arrays - Repeat the above for indices 1 through 4 (ask the user for a string and int, and store them) You should then get a key to search for from the user. If the key is in the array, then you should print the value at the same index in the values array. If the key is not in the keys array, then you should print "not found". Run 1: Enter key 1 asdf Enter value 1 7 Enter key 2 qwer Enter value 2 8 Enter key 3 zxcv Enter value 3 10 Enter key 4 fdsa Enter value 4 13 Enter key 5 i Enter value 5 -1 Enter key to display value for i Value for i is 1 Run 2 (key not found): Enter key 1 asdf Enter value 1 7 Enter key 2 qwer Enter value 2 8 Enter key 3 zxcv Enter value 3 10 Enter key 4 fdas Enter value 4 1 Enter key 5 i Enter value 5 5 Enter key to display value for asf Key asf not found Run 3: Enter key 1 a Enter value 1 1 Enter key 2 b Enter value 2 2 Enter key 3 c Enter value 3 3 Enter key 4 d Enter value 4 6 Enter key 5 e Enter value 5 0 Enter key to display value for d Value for d is 6

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!