Question: Observe the following code, which creates a simple hashtable. // Demonstrate a Hashtable import java.util.*; class HTDemo { public static void main(String args[]) { Hashtable

Observe the following code, which creates a simple hashtable. // Demonstrate a Hashtable import java.util.*; class HTDemo { public static void main(String args[]) { Hashtable numbers = new Hashtable(); numbers.put("one", new Double(1.0d)); numbers.put("two", new Double(2.0d)); } } Starting with this provided code, add the following functionality: Add the numbers 3 through 10 to the hashtable continuing in the same manner as shown. Prompt the user for a string, and display the corresponding number. For example, if the user types five, the program would output 5.0. This must be done using the hashtable as created in the previous step. Using a loop and a single println statement, display all of the values (both strings and integers) in a table.

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!