Question about java hashtables

Assignment Help Data Structure & Algorithms
Reference no: EM1380344

We are working on hashtables and I am trying to figure out a real life example that could be solved with hashtables to jtree as well as some type of array or jlist. I just need some opinions or examples of this part please.

Here is an exercise I do not understand in this chapter.

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

numbers.put("one", new Integer(1));
numbers.put("two", new Integer(2));

}
}

Starting with this provided code, add the following functionality:
1. Add the numbers 3 through 10 to the hashtable continuing in the same manner as shown.
2. Prompt the user for a string, and display the corresponding number. For example, if the user types "five", the program would output "5". This must be done using the hashtable as created in the previous step.
3. Using a loop and a single printlng statement, display all of the values (both strings and integers) in a table.

 

Reference no: EM1380344

Questions Cloud

It is vital to understand what metrics are : It is vital to understand what metrics are. Be sure to study the Conference permitted More Information on metrics the specific information desirable to calculate each metric must be discussed
Question about key encryption : Assume Alice wishes to send an e-mail to Bob. Bob has a public private key pair, Alice has Bob's certificate. But Alice does not have a public, private key pair.
Which accounting discipline is responsible : Her prospective banker has requested information concerning financial condition of her business. Which accounting discipline is responsible for providing accounting information to outside stakeholders.
Explain the process for handling conflicts : Explain the process for handling conflicts taking place in the organization and analyze the elements of organizational culture to improve corporate performance.
Question about java hashtables : Prompt the user for a string, and display the corresponding number. For example, if the user types "five", the program would output "5". This must be done using the hashtable as created in the previous step.
Which are three most relevant lessons learned : Which are three most relevant lessons learned of this reading. Please Explain why. Also analyze also discuss in great detail.
New keynesian model with technology shocks : Discuss the real output and in ation expressions verbally - New Keynesian model with technology shocks
Explain how do we balance this with our new found : We have touched on delicate balance of successful marketing also perhaps social ethics. Explain how do we balance this with our new found POWERFUL knowledge of consumer behaviour.
New keynesian model with technology shocks : Discuss the real output and in ation expressions verbally - New Keynesian model with technology shocks

Reviews

Write a Review

 

Data Structure & Algorithms Questions & Answers

  Finding page faults for lru replacement algorithms

How many page faults would happen for the given replacement algorithms, assuming one, two, three, and four frames?

  Implementing ajax programming

In the AJAX scripts construct, refer to the DSN datasource as flamingo. Even though its not in your own folder or directory, it has been set up as SYSTEM DSN, so your AJAX script will have access to it.

  Java program to assign passengers seats in airplane

Prepare a Java program to assign passengers seats in an airplane. Suppose a small airplane with seats numbered as follows:

  Use sequential search algortithm to locate the number

These numbers should be stored in an array. Use the sequential search algortithm to locate the number entered by the user. If the number is in the array, the program should display a message.

  Function to swap all the left-right subtrees of binary tree

Write a function, swapSubTrees, that swaps all of the left and right subtrees of a binary tree. write a method singleParent, that returns the number of nodes in a binary tree that have only one child.

  Algorithm to concatenate string in single binary search tree

Create algorithm which concatenates T1 and T2 into single binary search tree. Worst case running time must be O(h).

  Formula to compute number of address bus conductors

If an address bus needs to be able to address 8-devices, how many conductors will be needed? What if each of those devices also requires to be able to talk back to the I/O control device?

  Random walk simulation

A two dimensional array should be used to represent number of times the bug reached each tile on the floor. All cells of this array should be initialized to zero.

  Design time randomized monte carlo algorithm

You have to design an O(n) time randomized Monte Carlo algorithm which computes an (1 + o)- approximate ham-sandwich cut with probability 1 - n-c for any given constant c > 0.

  Compare the average behavior of insertion sort

Compare the average behavior of insertion sort for n elements with that of the n insertions into an initially-empty straight array implementation of a priority queue

  Designing and populating a course table

Use data to design and populate a course table. Designate the CourseID field as a Primary Key and permit your database to automatically produce a value for this field.

  Create a program that reads product number and prices

The Rinky Dooflingy Corporation produces different kinds of doofingies, each identified b a product number. Create a program that reads product number and rates and stores these values in two arrays,

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd