creates a simple hashtable

For this Assignment, submit the following program:

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. Compile, run, and check the results. Submit the following:

The source file (If more than one file has been created, zip them into one .zip file for posting.) An MS .doc file with explanations/comments of your solution and the results of a test run, including a screen shot picture The UML class diagram of the application should be included in the deliverable as a part of the MS .doc above, or as a separate file

Answer Detail

Get This Answer

Invite Tutor