Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objectives: Implement containsKey in the hash table FHmapSC. Define the class: WordAssistant. Get in the habit of dividing larger projects into smaller parts. Material from:

Objectives:
Implement containsKey in the hash table FHmapSC.
Define the class: WordAssistant.
Get in the habit of dividing larger projects into smaller parts.
Material from:
Syllabus and Program Guidelines.
Material discussing hash tables in module including the page HashMap: Separate Chaining.
Material from Chapter 5 of Weiss Book.
class SearchDestination, and example data files (included under the resource folder) in your assigned GitHub repository.
In this project, you'll take the hash table with separate chaining and modify it to implement containsKey() using the ideas presented in the modules.
class FHmapSC
Update the class with the following attributes and methods:
Methods:
ArrayList containsKey(Key requestedKey)- tests if the specified object is a requestedKey in this hash table. If found, returns the ArrayList of Value objects found. Otherwise, returns null.
Note: This method builds on top of the discussion question titled Searching for a Key in a Hash Table. However, the method return value is different. So, make sure to update the method to return an list of objects.
class WordAssistant
Implement the class with the following attributes and methods:
Attributes:
Instance variable sequenceTable of type FHmapSC
Methods:
A constructor which takes an argument of type FHlinkedlist and fills the hash table with sequences of substrings term attribute.
For each Word object in the FHlinkedlist, code as many substrings as there are characters in term attribute. A sequence is substring of 1 to n from term attribute.
The method findSequenceInTable() which takes a String as the key into the sequenceTable. If the argument is found, returns an ArrayList. Otherwise returns null.
An accessor method for the attribute sequenceTable.
class Word
Note: This class has already been implemented for you.
An object of type Word stores sequence of chars and a description.
Attributes:
Instance variable term of type String. Store one sequence of chars as a String.
Instance variabledescription of typeString. Stores the description read from the input file as is.
class FileReader
Note: This class has already been implemented for you.
Utility class that reads a CSV files with the key, value format.
class SearchDestination
Tests the functionality of class FHmapSC and class WordAssistant.
Specifically checks for implementation of containsKey() function to return an object associated with a given key input.
Instantiates a simple GUI that enables the user to search for a word. Uses Swing to generate a JFrame where the user can enter their search.
The result of the search is displayed as a list of descriptions.
Your sequence table should like as below for the given input destination.txt file:
Sequence table is: [ long be : {Long Beach is a coastal city and port in Southern CA.} long beac : {Long Beach is a coastal city and port in Southern CA.} sole : {Soledad is a city in Monterey Country.} long bea : {Long Beach is a coastal city and port in Southern CA.} los alto : {Los Altos in Spanish means for The Heights.} los angeles : {Los Angeles County, is the most populous county in US.} fremont : {Fremont was the location of the first Apple factory.} fre : {Fremont was the location of the first Apple factory.; Fresno is an agricultural epicenter in US.} fer : {Ferndale is the home of Guy Fieri.; San Francisco is known for its Golden Gate Bridge.} san francisco : {San Francisco is known for its Golden Gate Bridge.} los : {Los Altos in Spanish means for The Heights.; Los Angeles County, is the most populous county in US.} san : {San Francisco is known for its Golden Gate Bridge.; San Jose is California's oldest settlement founded in 1777.} santa : {Santa Clara sits at the heart of Silicon Valley.; Santa Maria was the location of fictional Zorro.} fresno : {Fresno is an agricultural epicenter in US.} santa cla : {Santa Clara sits at the heart of Silicon Valley.} los angele : {Los Angeles County, is the most populous county in US.; Los Angeles County, is the most populous county in US.} san jos : {San Jose is California's oldest settlement founded in 1777.} san fran : {San Francisco is known for its Golden Gate Bridge.} fe : {Ferndale is the home of Guy Fieri.} sa : {San Francisco is known for its Golden Gate Bridge.; Santa Clara sits at the heart of Silicon Valley.; San Jose is California's oldest settlement founded in 1777.; Santa Maria was the location of fictional Zorro.} frem : {Fremont was the location of the first Apple factory.; San Francisco is known for its Golden Gate Bridge.; Santa Clara sits at the heart of Silicon Valley.; San Jose is California's oldest settlement founded in 1777.; Santa Maria was the location of fictional Zorro.} los ange : {Los Angeles County, is the most populous county in US.} fres : {Fresno is an agricultural epicenter in US.} fr : {Fremont was the location of the first Apple factory.; Fresno is an agricultural ep

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

More Books

Students also viewed these Databases questions