Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Joe Celkos Data And Databases Concepts In Practice

Authors: Joe Celko

1st Edition

1558604324, 978-1558604322

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago