Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Modify the Lookup program given in the textbook (program 4.4.1) to make a program LookupMultipleNumber that prints out multiple values having the same key. Please

image text in transcribedimage text in transcribed

Modify the Lookup program given in the textbook (program 4.4.1) to make a program LookupMultipleNumber that prints out multiple values having the same key. Please add Commenting (code documentation)

Notes: The user would specify the maximum number of values to be printed out for each key as a command line argument after the file name.

Store all such multiple values in a queue. So each element of the symbol table would have a string as a key and a queue object as its value.

Sample runs would be as follows (refer to input file amino.csv).

>java LookupMultipleNumber amino.csv 2 3 0 Tryptophan TGG Cysteine TGT TGC

>java LookupMultipleNumber amino.csv 6 3 0 Cysteine TGT TGC Leucine TTA TTG CTT CTC CTA CTG

image text in transcribed

integers, one specifying the field to serve as the key and the other specifying the field to serve as the value. Program 4.4.1 Dictionary lookup Click here to view code image public class Lookup public static void main(String[] args) { // Build dictionary, provide values for keys in StdIn. In in = new In (args[0]); int key Field = Integer.parseInt(args[1]); int valField = Integer.parseInt(args[2]); String[] database = in.readAlllines(); StdRandom. Shuffle (database); ST st = new ST(); for (int i = 0; i st = new ST(); for (int i = 0; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Technology And Management Computers And Information Processing Systems For Business

Authors: Robert C. Goldstein

1st Edition

0471887374, 978-0471887379

More Books

Students also viewed these Databases questions

Question

4-6 Is there a digital divide? If so, why does it matter?

Answered: 1 week ago