Question: JAVA JAVA JAVA JAVA JAVA Create a hash table of phobias where each entry the key is the name of the phobia, and the data

JAVA JAVA JAVA JAVA JAVA

Create a hash table of phobias where each entry the key is the name of the phobia, and the data is the explanation.

Create a class Phobia

Instance variables

Name

Description

Methods

toString: overrides the base toString and returns the name plus the description

equals: returns true only if both the name and the description match

Create a hash table PhobiaHashTable where each of the buckets corresponds to letters in the English alphabet.

Each index corresponds to a letter of the alphabet, and a hash method should be implement where a phobia given will return the index

Every time there is a phobia that starts with the same letter simply add it to the end of the bucket

It is a good idea to make an array of ArrayLists

Methods

add: Adds a new phobia to the hash table

remove: if the phobias name and description matches then remove it. Get over that fear.

lookup: given the phobias name return the description

printHashTable: prints out all entry in the hash table

Create a front end where users can add, remove, look up, and print out their fears.

Example Dialog:

Welcome to the fear hash table!

Enter:

1. To add a fear

2. To remove a fear

3. To look up a fear

4. Print all fears

5. Quit

1

What is the fears name

Ancraophobia

Describe the fear

Fear of wind

Enter:

1. To add a fear

2. To remove a fear

3. To look up a fear

4. Print all fears

5. Quit

1

What is the fears name

Cyberphobia

Describe the fear

Fear of computers or working on a computer

Enter:

1. To add a fear

2. To remove a fear

3. To look up a fear

4. Print all fears

5. Quit

1

What is the fears name

Kakorrhaphiophobia

Describe the fear

Fear of failure or defeat

Enter:

1. To add a fear

2. To remove a fear

3. To look up a fear

4. Print all fears

5. Quit

1

What is the fears name

Lutraphobia

Describe the fear

Fear of otters

Enter:

1. To add a fear

2. To remove a fear

3. To look up a fear

4. Print all fears

5. Quit

1

What is the fears name

Arachibutyrophobia

Describe the fear

Fear of peanut butter sticking to the roof of the mouth

Enter:

1. To add a fear

2. To remove a fear

3. To look up a fear

4. Print all fears

5. Quit

1

What is the fears name

Barophobia

Describe the fear

Fear of gravity

Enter:

1. To add a fear

2. To remove a fear

3. To look up a fear

4. Print all fears

5. Quit

1

What is the fears name

Samhainophobia

Describe the fear

Fear of Halloween

4

Ancraophobia

Fear of wind

Arachibutyrophobia

Fear of peanut butter sticking to the roof of the mouth

Barophobia

Fear of gravity

Cyberphobia

Fear of computers or working on a computer

Kakorrhaphiophobia

Fear of failure or defeat

Lutraphobia

Fear of otters

Samhainophobia

Fear of Halloween

Enter:

1. To add a fear

2. To remove a fear

3. To look up a fear

4. Print all fears

5. Quit

5

Goodbye Fears

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!